html表中的多个Jquery倒计时
我正在做一个项目,我需要在一个页面上显示几个拍卖的状态。每个项目都有不同的结束日期。我正在使用html表中的多个Jquery倒计时,jquery,html-table,jquery-countdown,Jquery,Html Table,Jquery Countdown,我正在做一个项目,我需要在一个页面上显示几个拍卖的状态。每个项目都有不同的结束日期。我正在使用cfquery从数据库中提取数据,然后使用cfoutput构建一个表。那部分很好。没问题。我的问题是,如何在表中放置多个实例,以便每个项目都有倒计时 这是我的表格标题: <table id="large" class="tablesorter" border="0" CELLSPACING="1" CELLPADDING="0" width="50%"> <thead> <
cfquery
从数据库中提取数据,然后使用cfoutput
构建一个表。那部分很好。没问题。我的问题是,如何在表中放置多个实例,以便每个项目都有倒计时
这是我的表格标题:
<table id="large" class="tablesorter" border="0" CELLSPACING="1" CELLPADDING="0" width="50%">
<thead>
<tr class="tablesorter-headerRow">
<th id="itemnum" class="sorter-numeric">ItemNum</th>
<th id="highbidder" class="sorter-numeric">HighBidder</th>
<th id="closenum" class="sorter-numeric">Time Left</th>
<th id="highbidprice" class="sorter-numeric">HighBid</th>
</tr>
</thead>
<tbody>
<cfoutput>
<!--- Code builds the table body --->
<div class="countdown-styled clearfix" style="width:200px;"></div>
</cfoutput>
</tbody>
</table>
ItemNum
高价竞标者
剩下的时间
高价
我已经研究过这些:1)2)但是它们要么为每个页面包含一个唯一的行ID,然后是其他jquery代码,要么只是硬编码ID。问题是,我不知道最终版本上会有多少项。现在我有35,但这不是常数,所以我不能这么做。有什么想法或帮助吗?非常感谢。以下是他网站上的示例:
$(selector).countdown({until: new Date(2010, 12-1, 25)});
我假设你正在做这样的事情:
$('.countdown-styled').countdown({until: someDate});
因此,我们的想法是,每个$('.countdown styled')
都有不同的日期,您只需要了解如何为每个不同的元素指定日期
$('.countdown-styled').each(function (idx) {
var date = $(this).closest('tr').find('.date-label').text();
$(this).countdown({ until: new Date(date) });
});
当然,我不知道从哪里获取日期,因为我看不到您的所有代码,您可能需要调整从显示中生成javascript日期对象的代码,但这应该可以让您开始了。表体输出是什么样子的?它的结构将直接影响用于触发倒计时的jQuery。