You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I set up a Flipdown countdown timer to calculate how much time between when the CMS page is published and Midnight EST (when a callback changes a CSS class that removes an overlay).
var now = new Date();
var night = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() + 1, // the next day, ...
0, 0, 0 // ...at 00:00:00 hours
);
var timeUntilMidnight = night.getTime() - now.getTime();
Now, I'd like to use localStorage to make sure the countdown persists and keeps on ticking!
// get timer offset (if not found, set to today)
var now = new Date( localStorage.getItem('countdown-offset') || new Date() );
// store the offset
localStorage.setItem('countdown-offset', offset);
But when the count actually starts, wouldn't I want to use something like onUpdate ? Im actually not sure!
The text was updated successfully, but these errors were encountered:
I'm trying to understand your use case. FlipDown works by using a timestamp of some time in the future. If you know when your timer is due to end and store the original end-time in LocalStorage, when the user re-visits your page and the timestamp is retrieved from LocalStorage, the end time will still be the same and the counter will appear to have kept ticking while the user was away.
I set up a Flipdown countdown timer to calculate how much time between when the CMS page is published and Midnight EST (when a callback changes a CSS class that removes an overlay).
Now, I'd like to use localStorage to make sure the countdown persists and keeps on ticking!
But when the count actually starts, wouldn't I want to use something like
onUpdate
? Im actually not sure!The text was updated successfully, but these errors were encountered: