jQuery Countdown plugin break on IE and Safari

不羁的心 提交于 2019-12-11 07:24:07

问题


I'm using jQuery Countdown plugin with multiple instances on one page

<div class="TimeLeft">
    <?php echo counterDate($dl['end'][0]); //YYYY, MM, DD ?>
</div>
<div class="TimeLeft">
    <?php echo counterDate($dl['end'][1]); //YYYY, MM, DD ?>
</div>

and etc...

my jquery code use each function

$(".TimeLeft").each(function() {
        $(this).countdown({until:  new Date($(this).text()) , format: 'HMS', compact: true, 
    layout: '<span class="offerTimeStart">&nbsp;</span><span class="offerTimeContent">{hnn}</span><span class="offerTimeSep">&nbsp;</span><span class="offerTimeContent">{mnn}</span><span class="offerTimeSep">&nbsp;</span><span class="offerTimeContent">{snn}</span><span class="offerTimeEnd">&nbsp;</span>', serverSync: serverTime});
    });

All work perfect in Firefox and Chrome - plugin return correct hours until end date but IE and Safari shows just Nan Nan Nan

I try to use different time format such a Date and Hour but no success.


回答1:


Maybe you want to use DateRegex for "that thing" called IE :

Convert string to date in jQuery and Internet Explorer?

I hope this link will be helpful for you.

I don't know what solution about Safari, but try use IE way.



来源:https://stackoverflow.com/questions/7836875/jquery-countdown-plugin-break-on-ie-and-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!