jieyou / lazyload Goto Github PK
View Code? Open in Web Editor NEW一个jQuery或zepto的图片延迟加载插件。An jQuery | zepto plugin for lazy loading images.
一个jQuery或zepto的图片延迟加载插件。An jQuery | zepto plugin for lazy loading images.
Line 138 in 2de2da3
我发现在chrome上还是会进行全加载的,是chrome版本的问题吗?
一个商品详情,后台随机编辑上传图片后,只能让图片在手机上宽度100%,高度自适应的情况如何处理?
我在定义这个模块的时候顺序是这样的
$=require('zepto'),
lazyload=require('./lazyload.min');
但是他还是会提示zepto加载不到的问题。
包括直接用
seajs.use(['zepto','lazyload'],function($){
})
两种都会提示找不到jq或者zepto的问题
代码里options参数没有继承
比如:
那么我在belowthefold函数里应该可以console.log(options.threshold);
function belowthefold($element, options){
console.log(options.threshold);
var fold
if(options.$container == $window){
fold = ('innerHeight' in w ? w.innerHeight : $window.height()) + $window.scrollTop()
}else{
fold = options.$container.offset().top + options._$container.height()
}
return fold <= $element.offset().top - options.threshold
}
结果我发现,options.threshold还是0
我觉得应该在$.fn.lazyload方法里加$.extend(defaultOptions, options || {});
你好,
看到lazyload在移动端的用法是
<div class="lazy" data-original="img/example.jpg"><div>我想问问,为什么在移动端要用div的backgroud-iamge来显示图片,而不用img标签呢?
例:
有一个选项卡,选项卡里的内容是ajax的请求数据,并通过字符串拼接然后插入到某个区域里的,可图片无法加载,在PC浏览器没问题,测试过多台手机,但在QQ浏览器和微信浏览器、UC浏览器有问题,图片无法显示,百度手机浏览器没有问题。
如题
Hi, nice work.
MIT license means you can do everything else but remove the original authors name from the source. So it would be polite to put it back.
rt,我想实现一个滚动统计的效果,图片的 data-original
不是一个图片的路径而是后台服务器的一个get请求的路径。我想让屏幕滚动的时候将这个路径赋值到src上但是并不好使啊,请问这个我该怎么做呢
现在好像没有更换图片的快捷方法?
只能重新初始化 $("img.lazy").lazyload({})
这样,里面的监听的事件没有消除,并且会重复添加?
如果是图片列表页面,可以给img删除src属性然后加上data-original属性;
可是如果是后台编辑框插入的图片,这个怎样删除img的src属性呢?
#使用背景来替换src,结果安卓客户端(魅族)background-images得不到值。
$('<img />').on('load', function(){
alert('这里走不通...')
loadFunc()
if(options.load != emptyFn){
options.load.call(element, $element, $elements.length, options)
}
}).attr('src',originalSrc)
enabled_wide_container例子有bug,情况描述如下:
横向滚动,图片没有加载,当触发窗口滚动条,图片才会加载,我测试了竖向,也是这样,滚动container图片不会加载,滚动窗口滚动条才会加载。
在chrom的devtool的network中,发现一张图片被加载两次。
使用zepto v1.2,AMD加载。请教下这是什么原因呢?
现在的默认的填充图是grep.gif,如果我设置为我的一个动态的图,例如iOS的菊花,然后菊花会被拉升整个图像的大小,如何处理?
我用了iScroll来滚动,iScroll区域使用可是使用lazyload只能加载首屏的数据,超出的部分滚动的时候不会加载,如果在chrome调试区域修改拉升模拟器屏幕的高度,会触发加载刚刚显示的数据
具体描述如下:
当ajax获取json中的图片地址,并插入空白页面后,图片插入的区域在可视区域内并超过可视范围,lazyload会失效,图片会全部加载,经测试发现,如果插入的图片不在可视区,loazyload正常。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
<div id="list"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
<div>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br>t<br></div>
<div id="list"></div>
</body>
</html>
$.ajax({
url: 'js/data.json',
type: 'GET',
dataType: 'json'
}).done(function(response) {
var products = response.products;
var _str = '';
for (var i = 0; i < products.length; i++) {
_str+='<div><img class="lazy" data-original="'+products[i].logourl+'"></div>';
};
$('#list').append(_str);
$('img.lazy').lazyload({
effect : "fadeIn"
});
})
使用jq 可以,但是zepto没有效果
页面中有部分内容是react组件,引用之后就导致lazyload不可用?有解决办法吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.