87,993
社区成员
发帖
与我相关
我的任务
分享
$(document).on("click",".Nav-item",function(){
$.ajax({
type:'get',
url:'/Store/Category/index?do=getSonCategory',
data:data,
async:false,
dataType:'json',
success:function(jsonData) {
// console.log("flag");
// console.log(jsonData);
if(jsonData.state) {
var goods = jsonData.goods;
var html;
$.each(goods, function (key, item) {
html = ' <img src="__STATIC__/img/sysImgs/loading.gif" class="img' + key + '" data-original="' + item.img + '">\n';
})
$('.uls').append(html);
is(html);
}
}
})
})
function is(html) {
$("img.lazy",html).lazyload({
placeholder : "__STATIC__/img/sysImgs/loading.gif",
container:$('.uls'),
effect: "show",
});
console.log(html);
}
$(document).on("click",".Nav-item",function(){
$.ajax({
type:'get',
url:'/Store/Category/index?do=getSonCategory',
data:data,
async:false,
dataType:'json',
success:function(jsonData) {
// console.log("flag");
// console.log(jsonData);
if(jsonData.state) {
var goods = jsonData.goods;
var html;
$.each(goods, function (key, item) {
html = ' <img src="__STATIC__/img/sysImgs/loading.gif" class="img' + key + '" data-original="' + item.img + '">\n';
})
$('.uls').append(html);
is();
}
}
})
})
function is() {
$("img",$('.uls')).lazyload({
placeholder : "__STATIC__/img/sysImgs/loading.gif",
container:$('.uls'),
effect: "fadeIn",
threshold:1000,
skip_invisible:false,
effectspeed:1000
});
}
已解决 这样可以实现图片缓加载