我不确定发生了什么,但我正在设置新内容,并试图为每个项目添加倒计时但是它似乎没有起作用,抱歉不太确定如何解释它。
没有这个脚本的倒计时部分,请看下面的脚本工作正常
COUNT DOWN PART
$('#countdown'+members[i]['id]']).countDown({
targetDate: {
'day': 17,
'month': 12,
'year': 2012,
'hour': 01,
'min': 0,
'sec': 0,
},omitWeeks: true
});
和脚本的html端
function realcashNowCallback(page_index, jq){
// Get number of elements per pagionation page from form
var items_per_page = 8;
var max_elem = Math.min((page_index+1) * items_per_page, members.length);
var newcontent = '';
// Iterate through a selection of the content and build an HTML string
for(var i=page_index*items_per_page;i<max_elem;i++)
{
memberscountdown = members[i]['enddate'];
newcontent += '<div id="offer1" class="realcashnowitems">'+
'<div id="title1" class="moreofferstop">' + members[i]['tradingname'] + '</div>'
+' <div id="defaultCountdown" class="moreoffers"> '
+'<div id="pic1" class="productimagesmall"><img style="width:180px;" src="'+ members[i]['picurl']+'"></div>'
+'<div id="description1" class="descriptionsmall">'+ members[i]['des']+'</div>'
+'<div id="spend1_0" class="spendget1">SPEND $'+members[i]['offers'].split('|')[0].replace('.00', '').replace(' $', '')+'<br/><span>GET $'+members[i]['offers'].split('|')[1].split(',')[0].replace(' $', '').replace('.00', '')+'</span></div>'
+'<div id="countdown'+members[i]['id']+'"class="spendget2">';
newcontent += '</div>'
+'<div class="buttonmore"><a id="link1" href="'+ members[i]['url'] +'"><img src="template/images/elmos/More_Button.png"></a></div> '
+'</div>'
+'<div id="sub1" class="moreoffersbottom">'+ members[i]['suburb']+'</div>'
+'</div>';
$('#countdown'+members[i]['id']).countDown({
targetDate: {
'day': 17,
'month': 12,
'year': 2012,
'hour': 01,
'min': 0,
'sec': 0,
},omitWeeks: true
});
}
// Replace old content with new content
$('#Searchresult').html(newcontent);
// Prevent click eventpropagation
return false;
}
答案 0 :(得分:0)
在不了解您的问题以及“无法正常工作”的情况下,我认为这是个问题:
$('#countdown['+members[i]['id]']).countDown({
应该是
$('#countdown['+members[i][id]+']').countDown({