我已经实施了Keith Wood的countdown.js来迭代一系列特别优惠并提供倒计时。
onExpiry它会触发一个函数,该函数会添加一个类,然后覆盖一个“过期”图像并叠加在该商品上。
它在所有浏览器中都能完美运行(到目前为止)吧IE8并且我无法为我的生活找出原因。
IE8正在抛出一个脚本错误,但它并没有真正帮助我......
“对象不支持此属性或方法”..
$(document).ready(function(){
// loop over each offer
//var currentOffer;
$('.df-offer').each(function(){
currentOffer = $(this);
//get and set the height of the expired overlay incase the content pushes it passed the design
offerHeight = $(this).height();
offerWidth = $(this).width();
$('.df-special-offer-overlay').height(offerHeight);
$('.df-special-offer-overlay').width(offerWidth);
//coundown timer for each offer
//create tne offer end date object from the string in the markup
stringDate = $('.end-date', this).text().split("/");
offerEnd = new Date(stringDate[2], stringDate[1] - 1, stringDate[0]);
$('.timer', currentOffer).countdown({until: offerEnd, compact: true, alwaysExpire:true, onExpiry: function(){expireOffer(currentOffer);}});
});
function expireOffer(offer){
offer.addClass('expired');
//remove the href value incase someone tries to get clever and inspects the page for the offer URL.
// leaves the attribute in place so the page still validates
$('a.df-button', offer ).attr('href','#');
};
});
答案 0 :(得分:1)
看起来您可能需要更新jquery.plugin.js
请参阅 Object doesn't support this property or method IE8 and Countdown.js Plugin 和 https://github.com/kbwood/countdown/issues/41