jquery - JavaScript Site - Countdown Timer -


I'm looking for a timer that starts a countdown timer until you change the page, the code is ok Works Timer runs through the loop and the timer starts again.

Ideally I want to countdown the timer regardless of the page on the whole domain.

In addition, if $ sessionDecline is clicked I want to be applied 10 minute timer, otherwise the $ sessionAccept 5 minutes to return to the homepage with a counter. SessionTime = 2000, tickDuration = 1000, $ sessionAccept = $ ('# session - accept'), $ sessionDiskline = $ ('# session - declines') on

 ; If (Modernizr.localstorage & amp; lscache.get ('sessionActive') === tap) {var myInterval = setInterval (function () {SessionTime = SessionTime - tickDuration}, 1000), myTimeOut = setTimeout (SessionExpireEvent, SessionTime); } And if (Moderni.Local storage & amp; amp; lscache.get ('sessionActive') === true) {session = 6000; On myInterval = setInterval (function () {SessionTime = SessionTime - tickDuration}, 1000), myTimeOut = setTimeout (SessionExpireEvent, SessionTime); } Function Session ExpireEvent () {clearInterval (myInterval); . $ ('# Timout - Popup') addClass ('is - loaded'); $ SessionAccept.click (function () {window.location.href = '/'; lscache.set ('sessionActive', true); $ (this) .closest ('overlay__wrapper') .removeClass ('is - loaded ');}); $ SessionDecline.click (function () {lscache.set ('sessionActive', false); $ (this) .closest ('overlay__wrapper.') .removeClass ('is - loaded');}); }  

I am using:

jquery v1 / / custom modernizr

Sorry in advance to create coded examples.

I would know what will be the date / time of 10 or 5 minutes from now, and the value that you can do in jQuery $ Cookie ("test", 1);

Calculate milliseconds so far until your goal is met and set your time for that many milliseconds.

Look at the page load check to see if your cookie usage is $. Cookie ("testing"); If this is set, then use that value to set it timeout, if not, calculate your timeout and set a cookie.

Also make sure to delete the cookie by using $ in your code. Cookie ("exam");


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -