首页 > lazyload 懒加载切换选项后图片不显示,滑动鼠标才显示出来,怎么实现切换选项立即加载?

lazyload 懒加载切换选项后图片不显示,滑动鼠标才显示出来,怎么实现切换选项立即加载?

如题,怎么解决,谢谢 :)
附上链接:www.bgoo.me


详见官方文档说明,也就是需要你绑定自定义事件来触发懒加载。

Event to Trigger Loading
You can use jQuery event such as click or mouseover. You can also use custom events such as sporty or foobar. Default is to wait until user scrolls down and image appears on the viewport. To load images only when user clicks them you could do:

javascript$("img.lazy").lazyload({
    event : "click"
});

PRO TIP! You can use this for tricks like delayed loading of images. Following code waits five seconds after rest of page has finished loading before it loads images. See it working at delayed loading demo.

javascript$(function() {
    $("img.lazy").lazyload({
        event : "sporty"
    });
});
javascript$(window).bind("load", function() {
    var timeout = setTimeout(function() {
        $("img.lazy").trigger("sporty")
    }, 5000);
});
【热门文章】
【热门文章】