Quantcast
Viewing all articles
Browse latest Browse all 9897

Idle time to reload page

Hi everyone,

 

Can you help me how to write the code right Image may be NSFW.
Clik here to view.
.

 

I want when on the site have idle time without move or touch to reload the page, in order to start from the beginning.

 

At Stage -> CreationComplete I have:

 

idleTime = 0;

$(document).ready(function () {

    //Increment the idle time counter every minute.

    var idleInterval = setInterval(timerIncrement, 60000);

 

 

    //Zero the idle timer on mouse movement.

    $(this).mousemove(function (e) {

        idleTime = 0;

    });

    $(this).keypress(function (e) {

        idleTime = 0;

    });

});

 

 

function timerIncrement() {

    idleTime = idleTime + 1;

    if (idleTime > 1) {

        window.location.reload();

    }

}

 

when I tested local it worked, but online it doesn't.

 

What is missing?

 

 

Thanks in advanced.


Viewing all articles
Browse latest Browse all 9897

Trending Articles