懒图片 / LazyImg
优质
小牛编辑
131浏览
2023-12-01
<button id="alert">
点我显示警告
</button>
require(['jquery', 'moye/LazyImg'], function ($, LazyImg) {
var html = ['<div class="content"><div class="lazy-img">'];
var img1 = 'https://tb2.bdstatic.com/tb/static-common/img/search_logo_039c9b99.png';
var img2 = 'https://www.baidu.com/img/bdlogo.gif';
for (var i = 0; i < 100; i++ ) {
html.push('<img src="' + img1 + '" _src="' + img2 + '?_t=' + (i) + '" />');
}
html.push('</div></div>');
document.write(html.join(''));
LazyImg.load({
offset: {
y: 1250
}
});
});