我不確定發生了什麼,但我設置newcontent並嘗試爲每個項目添加一個倒計時它似乎沒有工作,抱歉,不太確定如何解釋它。jQuery倒計時停止頁面顯示
用了這個腳本的倒計時部分看到下面的腳本工作正常
COUNT DOWN PART
$('#countdown'+members[i]['id]']).countDown({
targetDate: {
'day': 17,
'month': 12,
'year': 2012,
'hour': 01,
'min': 0,
'sec': 0,
},omitWeeks: true
});
和腳本
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;
}
是不是一個錯誤:'$( '#倒計時' +會員[I] [ 'ID]'])'? – Igor 2012-04-17 01:24:09
這是一個錯字 – RussellHarrower 2012-04-17 01:32:34