auto refresh Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
3 posters

    auto refresh

    qmars(pkq)
    qmars(pkq)
    Forumember


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

    In progress auto refresh

    Post by qmars(pkq) June 19th 2014, 10:01 am

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


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

    In progress Re: auto refresh

    Post by SSYT June 19th 2014, 10:59 am

    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
    qmars(pkq)
    qmars(pkq)
    Forumember


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

    In progress Re: auto refresh

    Post by qmars(pkq) June 19th 2014, 11:37 am

    add this cod too where bro?
    SSYT
    SSYT
    Forumember


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

    In progress Re: auto refresh

    Post by SSYT June 19th 2014, 4:08 pm

    Sorry Smile
    Go to: Administration Panel ~> Module ~> HTML & JAVASCRIPT ~> JavaScript code management.
    qmars(pkq)
    qmars(pkq)
    Forumember


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

    In progress Re: auto refresh

    Post by qmars(pkq) June 21st 2014, 11:05 am

    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
    SSYT
    SSYT
    Forumember


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

    In progress Re: auto refresh

    Post by SSYT June 21st 2014, 6:42 pm

    I do not understand what you mean.
    You want a class / id to Forum Refresh?
    qmars(pkq)
    qmars(pkq)
    Forumember


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

    In progress Re: auto refresh

    Post by qmars(pkq) June 24th 2014, 1:19 pm

    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
    Jophy
    Jophy
    ForumGuru


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

    In progress Re: auto refresh

    Post by Jophy June 25th 2014, 10:23 am

    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.