The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

auto refresh

3 posters

Go down

In progress auto refresh

Post by qmars(pkq) Thu 19 Jun 2014 - 10:01

hello forumotion team
how can i have auto refresh in my home pege?
for example for each 20 sec
qmars(pkq)
qmars(pkq)
Forumember

Posts : 219
Reputation : 1
Language : english,persian
Location : iran

http://lemon-13.full-forum.com

Back to top Go down

In progress Re: auto refresh

Post by SSYT Thu 19 Jun 2014 - 10:59

Code:
jQuery().ready(function($){
   refresh_interval = 20000; // 20 sec
   setTimeout(function(){
      window.location.reload();
     console.log("refresh time is" + refresh_interval)
   }, refresh_interval);
});
try my code Smile
SSYT
SSYT
Forumember

Male Posts : 77
Reputation : 15
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

In progress Re: auto refresh

Post by qmars(pkq) Thu 19 Jun 2014 - 11:37

add this cod too where bro?
qmars(pkq)
qmars(pkq)
Forumember

Posts : 219
Reputation : 1
Language : english,persian
Location : iran

http://lemon-13.full-forum.com

Back to top Go down

In progress Re: auto refresh

Post by SSYT Thu 19 Jun 2014 - 16:08

Sorry Smile
Go to: Administration Panel ~> Module ~> HTML & JAVASCRIPT ~> JavaScript code management.
SSYT
SSYT
Forumember

Male Posts : 77
Reputation : 15
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

In progress Re: auto refresh

Post by qmars(pkq) Sat 21 Jun 2014 - 11:05

it was working
but i want when i dont use the mouse or forum after the page be refresh
becuase when i chat in chat box it can refresh automaticaly and it make users angry
qmars(pkq)
qmars(pkq)
Forumember

Posts : 219
Reputation : 1
Language : english,persian
Location : iran

http://lemon-13.full-forum.com

Back to top Go down

In progress Re: auto refresh

Post by SSYT Sat 21 Jun 2014 - 18:42

I do not understand what you mean.
You want a class / id to Forum Refresh?
SSYT
SSYT
Forumember

Male Posts : 77
Reputation : 15
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

In progress Re: auto refresh

Post by qmars(pkq) Tue 24 Jun 2014 - 13:19

InFeRn0 wrote:I do not understand what you mean.
You want a class / id to Forum Refresh?
i mean i want auto refresh in my forum but when im not using forum and when im not in chat box or write topics
qmars(pkq)
qmars(pkq)
Forumember

Posts : 219
Reputation : 1
Language : english,persian
Location : iran

http://lemon-13.full-forum.com

Back to top Go down

In progress Re: auto refresh

Post by Jophy Wed 25 Jun 2014 - 10:23

Hello,

If you want the auto refresh not to work when you're moving around or typing, try this code:

Code:
$(function() {
    var idletime=0;
    
 setInterval(function() {
 idletime += 1;
    if (idletime > 20) {
        window.location.reload();
      }
    }, 1000);
 
 $(this).on('mousemove', function(e) {
  idletime=0;
 });
 
 $(this).on('keypress', function(e) {
  idletime=0;
         });
});

Now in this part:

Code:
if (idletime > 20)

20 means 20 seconds, if you want longer or shorter refresh intervals, you can increase or decrease that number.
Jophy
Jophy
ForumGuru

Male Posts : 17924
Reputation : 836
Language : English
Location : Somewhere

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum