Jquery LazyLoad.js 窗口大小调整后加载问题
我正在为我的网站运行 LazyLoad 脚本,但其中的一个小方面存在问题。
我在水平滚动(从左到右)上使用延迟加载,图像相当宽。该脚本运行完美,并在 200 像素(或任何默认值)内淡入。
但是我注意到,如果窗口打开到较小的尺寸,然后打开到整个窗口,则占位符“延迟加载”仅加载在较小的窗口尺寸期间“在视图中”的图像。一旦滚动条移动,它就会加载,但我很好奇是否有任何脚本可以添加“当窗口大小调整时,重新测量观看空间”
希望这是有道理的。我对 JavaScript 知之甚少,所以如果有人知道如何解决这个问题,请随时回复,就好像您正在与 5 岁的孩子交谈一样,并提供逐步说明:)
Im running the LazyLoad script for my website and having an issue with one small aspect of it.
Im using Lazy Load on a Horizontal scroll (left to right) with fairly wide images. The script works perfectly and fades in within 200px (or whatever the default is).
However I noticed if the window is opened to a smaller size, then opened to full window, the placeholder, Lazy Load has only the image loaded that was "In View" during the smaller window size. It loads once the scroll bar is moved, but Im curious if there's any scripting I could add along the lines 'When the window resizes, re-gauge the viewing space'
Hopefully this makes sense. I know very little about JavaScript so if anyone knows how to solve this feel free to respond as if you were talking to a 5 year old with step by step instructions :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
找到这行代码(在lazyload.js中):
并在其后添加:
Find this line of code (inside lazyload.js):
and add after that this:
将 failure_limit 设置为 10 会导致插件在找到首屏下的 10 个图像后停止搜索要加载的图像。如果您有一个时髦的布局,请将此数字设置为较高的值以解决您的问题,例如:
Setting failure_limit to 10 causes plugin to stop searching for images to load after finding 10 images below the fold. If you have a funky layout set this number to something high to solve your problem, an example: