带有动态加载图像和链接的 Javascript 或 jQuery 图像轮播
是否有一个好的 javascript 或 jQuery 图像轮播可以显示 5 个图像,如果有更多图像,用户可以单击“下一步”,以下图像源和链接 URL 将通过 AJAX 加载?
很可能有数千张图像,每个链接都指向专门用于该图像的网页,因此我基本上需要一个可以有效处理此问题的图像轮播。
Is there a good javascript or jQuery image carousel that will display 5 images and if there are more, the user can click next and the following image sources and link URLs will load through AJAX?
It's very possible there are thousands of images and each links to a webpage devoted to that image, so I basically need an image carousel that can efficiently deal with this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为 JQuery Cycle 插件 将为您提供 50% 的帮助。这个工具非常容易使用,我认为会给你带来你想要的“点击获取更多”图像功能(还有一些非常漂亮的过渡效果)。
但是,我只使用了该插件以及页面中定义的所有图像。就我而言,我正在制作“幻灯片”来演示应用程序的使用。 HTML 非常简单...
关联的 JavaScript 是...
(单击此处查看效果。
)为了解决当用户想要获取更多图像时加载新图像的额外挑战,我认为这只需扩展示例中“下一步”链接后面的代码即可。您的代码将执行 JQuery AJAX 调用来获取下一个图像,然后将它们添加到 幻灯片 div。
最后,只剩下单击图像即可访问该网站的功能。您可以尝试将幻灯片
img
标签放入适当的a
标签内。如果循环插件无法使用a
标签,则图像上的onclick
事件处理程序应该可以完成工作。I think the JQuery Cycle Plugin will get you 50% of the way there. This facility is pretty easy to use and I think will give you the "click to get to more" images functionality that you're after (with some pretty nifty transition effects at that).
However, I've only used the plugin with all the images defined in the page. In my case, I was doing a "slide show" to demonstrate the use of an application. The HTML was pretty simple...
The associated JavaScript is...
(Click here to see the effect.)
As for addressing the additional challenge of loading new images when the user wants to fetch some more, I think that's just a matter of expanding on the code behind the "Next" link in my example. Your code would perform a JQuery AJAX call to get the next images and then add them to the slideshow div.
Lastly, that leaves the functionality of clicking on the image to go to the site. You can try putting the slideshow
img
tags inside of appropriatea
tags. If the cycle plugin doesn't play will with thea
tags,onclick
event handlers on the images should get the job done.您可以使用 jQuery Tools' Scrollable 作为滑块并将
$get()
调用与“下一步”按钮相关联。这是一个演示:
http://flowplayer.org/tools/demos/scrollable/edit.htm (注意“添加”按钮)。
在此演示中,它只是克隆一个
div
并附加它。单击“下一步”但从其他地方加载内容时,您可以执行相同的操作。You could use jQuery Tools' Scrollable as slider and associate a
$get()
call to the 'next' button.Here's a demo:
http://flowplayer.org/tools/demos/scrollable/edit.htm (Notice the 'add' button).
In this demo, it just clones a
div
and append it. You could do the same when clicking on 'next' but loading content from elsewhere.我在一个项目中使用了 jShowOff。
优点:
问题
http://ekallevig.com/jshowoff/
我有一个示例我对它的使用此处:http://www.rhmachine.com/(链接可以修改为仅显示上一个/下一个)
我会仔细研究一下,看看是否可以找到一个已经为此制作的 AJAX 解决方案。
I've used jShowOff for a project.
Benefits:
Problem
http://ekallevig.com/jshowoff/
I have an example of my use of it here: http://www.rhmachine.com/ (the links can be modified to only show prev/next).
I'll dig around for a bit and see if I can find an AJAX solution already made for it.
第一个解决方案非常好,您可能会喜欢并且我使用的另一个解决方案:http://jquery.malsup。 com/周期/
The first solution is pretty good, another solution that you might like and that I use : http://jquery.malsup.com/cycle/