具有 AJAX 功能的 jQuery 循环插件
我有一个页面,其中有多个图片滑块(例如 50 个滑块+,每个滑块有 5-10 张图片)。不幸的是,由于滑块数量巨大,页面加载速度非常慢:- (
到目前为止,我一直在使用 Malsup 著名的 jQuery Cycle 插件。但是,这缺乏 AJAX 功能,因为需要在启动循环之前加载图片 ?
我有半经验,但没有时间编写适合我需要的库,
因此问题是,有人了解 Jquery 滑动(Ajax 加载)图片插件吗 但有太多的数据压倒了真实的结果..
提前致谢!
I have a page where I'll have multiple picture sliders (like 50 sliders+ with 5-10 pictures each). Unfortunately because of this massive amount of sliders, the page loads really slow :- (
Until now I've been using the famous jQuery Cycle Plugin by Malsup. However, this lacks AJAX functionality, as the picture's needs to be loaded before firing the cycle function.
I'm semi experienced, but lacking the time to write my own libary suiting my needs.
Hence the question, does anyone have knowledge of a Jquery sliding (Ajax loading) picture plugin? I've been searching all over the web, but there's too much data overwhelming the real results..
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一种黑客攻击,但可能对您有用,滑块插件支持前后功能,我们可以利用该功能来为您推迟图像的加载。
给出以下标记:
请注意,前两个具有有效的 src attr,但其余的是 asrc,它不是通过浏览器加载的。
现在,通过 before 和 after 函数,我们可以利用它并将 asrc 切换到真正的 src,这将导致浏览器查询图像。
jsfiddle 上的示例。
This is sort of a hack but might be able to work for you, the slider plugin supports a before and after function which we can take advantage of to defer the loading of the images for you.
given the following markup:
Notice the first two have valid src attr, but the rest are asrc which is not loaded via the browser.
Now with the before and after function we can take advantage of that and switch the asrc to a real src which will cause the browser to query for the image.
Example of this on jsfiddle.