Inb*_*bal 5 html javascript jquery lazy-loading jquery-lazyload
我有一个包含许多标签的html文件.
我想在滚动事件上加载图像,并卸载不可见的图像.就像在Aamzaon查看器中一样,当您向上/向下滚动时,框架中的当前图像是延迟加载的.
我看到了很多LazyLoad工具,但是没有一个工具具有卸载功能.
小智 2
使用此插件 jquery:https://github.com/morr/jquery.appear 并使用事件:appear 显示图像并消失卸载图像:
$('someselector').on('appear', function(event, $all_appeared_elements) {
// this element is now inside browser viewport
});
$('someselector').on('disappear', function(event, $all_disappeared_elements) {
// this element is now outside browser viewport
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3435 次 |
| 最近记录: |