我有动态块,可以在随机排序的表中显示和隐藏产品。但是当现金页面处于活动状态时,页面的这一部分会显示产品并仅显示查询中的第一个产品...我不明白如何使其具有这种效果并在随机排序时显示 10 个产品...查询
$sql = "SELECT * FROM " . DB_PREFIX . "product";
$sql .= " WHERE sp_id = ".$id." AND show=1";
$sql .= " ORDER BY shop_id asc";
$query = $this->db->query($sql);
返回$查询->行;
并与 ajax 分开:
<div id="content" class="group">
<div id="backItem">
<div id="footerItemContent">
</div>
<div id="footerItemDivider">-</div>
<div id="footerItemCustomer">...</div>
</div>
</div>
</div>
</div>
和我的功能
$(document).ready(function() {
var products = function() {
for ( var i = 0; i < complex.length; i++ ) {
var name = complex[i]['pr_name'];
var desc = complex[i]['pr_text'];
}
var i = 0;
var fnchange = function() {
$('#footerItemContent').animate({'opacity': 0}, 2000, function () {
$(this).text(desc);
}).animate({'opacity': 1}, 2500);
$('#footerItemCustomer').animate({'opacity': 0}, 2000, function () {
$(this).text(name);
}).animate({'opacity': 1}, 2500);
if( ++i < json.length ){
setTimeout(fnchange, 10000);
} else {
i = 0;
setTimeout(fnchange, 10000);
}
};
setTimeout(fnchange, 1);
};
setTimeout(feedbacks,1);