Jump to content

Countdown time display error on iPhone only


Recommended Posts

Hello,

at my wits end- (should preface this by saying I know enough about coding to be able to navigate through and troubleshoot things) however I cannot figure this one out -

Im pretty confident the reason for this time countdown not displaying on iPhone/iOS devices is its format. I need some help with what to change it to so it will display on iPhone. This is the only device it is not working on. Specifically the section message to display is what I think the problem is? Maybe Im wrong. The full js code is posted below under <---Js---> Thanks for any help anyone can lend.

function fronttimer(date, selector, idx, message_to_display){

countDownDate[idx] = new Date(date).getTime();

timeout[idx] = setTimeout(function() {

now = new Date().getTime();

distance = countDownDate[idx] - now;

days = Math.floor(distance / (1000 * 60 * 60 * 24));

hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));

minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));

seconds = Math.floor((distance % (1000 * 60)) / 1000);

 

selector.html(message_to_display + days + "d " + hours + "h "

+ minutes + "m " + seconds + "s ");

fronttimer(date, selector, idx, message_to_display);

}, 1000);

}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...