还不是很好用,还在调试
$('.hot-list').lazyload('',function (o) {
var rankUrl = 'findList.json',
url = 'findItemList.json',
groupId = $(o).attr('data-group');
$.post(rankUrl,{groupId:groupId},function (d) {
if(d.body['totalCount']==0){
// $(o).remove();
return
}else{
console.log(groupId);
rankData.groupId = groupId;
rankData.rankingId = d.body.list[0].rankingId;
}
});
$.post(url,rankData,function (d) {
var itemStr='';
if(d.body['totalCount']==0){
itemStr += '<div>什么都没有</div>';
}else{
$.each(d.body.list,function (i,d) {
itemStr += '<div class="swiper-slide">\
<div class="thumbnail">\
<a href="'+ d.targetUrl +'"><img data-src="'+ d.imageUrl +'" src="" alt=""></a>\
</div>\
<div class="introduction">\
<h3 class="name">'+ d.title +'</h3>\
<p class="price">'+ d.title +'</p>\
</div>\
<i class="icon icon-price"></i>\
</div>';
});
}
$('[data-group'+ rankData.groupId +']').append(itemStr);
});
})