-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
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!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels