{insert_scripts files=‘jquery-1.8.3.min.js,jquery.lazyload.js,use_img_lazyload.js‘}
//file use_img_lazyload.js
///<reference path="jquery-1.7.2.js" />
function checkbrowse() {
var ua = navigator.userAgent.toLowerCase();
var is = (ua.match(/\b(chrome|opera|safari|msie|firefox)\b/) || [‘‘, ‘mozilla‘])[1];
var r = ‘(?:‘ + is + ‘|version)[\\/: ]([\\d.]+)‘;
var v = (ua.match(new RegExp(r)) || [])[1];
jQuery.browser.msie = is;
jQuery.browser.version = v;
return {
‘is‘: jQuery.browser.msie,
‘ver‘: jQuery.browser.version
}
}
var public = checkbrowse();
var showeffect = "";
if ((public[‘is‘] == ‘msie‘ && public[‘ver‘] <= 8.0)) {
showeffect = "show"
} else {
showeffect = "fadeIn"
}
jQuery(document).ready(function ($) {
$("img").lazyload({
placeholder: "themes/1hdshop/images/images_lazy_bg1.jpg",
effect: "show",
failurelimit: 10, //设为 10 令插件找到 10 个不在可见区域的图片是才停止搜索. 如果你有一个猥琐的布局, 请把这个参数设高一点.
threshold : 20 , // threshold
为 20 令图片在距离屏幕 20 像素时提前加载.
skip_invisible : false //加载隐藏图片
})
});
本文出自 “惊鸿一羽” 博客,请务必保留此出处http://haocaige.blog.51cto.com/1319521/1394634