使用ajax和jquery更改滑块的内容
我必须做以下事情:我在图像滑块下方有一个内容滑块。每当用户在内容滑块的类别之间切换时,图像滑块应该显示另一组图片(我使用 WordPress,所以这是类别的另一个循环),但无需重新加载整个网站。
您知道这方面有什么好的资源吗?
I have to do the following thing: I have a content-slider beneath a image-slider. Everytime the person switches between the categories of the content-slider, the image-slider should show another set of pictures (I work with wordpress, so it's another loop of category) but without reloading the whole site.
Do you know any good resource for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
类似的东西 -
在你的 php 中将提供图像 -
jQuery 代码将是
Something like -
In you php that will serve up the images -
and the jQuery code would be
好吧,我会建议一些与上述解决方案不同的东西。扩展 jquery 库,以便您可以使用一堆需要根据滑块级别隐藏/显示的类来初始化它。
该扩展将接受一组不同的类,这些类被赋予您的各个 div
说
var level= ['.div1','.div2','.div3']
现在根据滑块所在的位置您将隐藏/显示该 div。
因此,如果滑块位于 2,那么您可以执行类似
$(level[2]).show()
和$(level[1]).hide() 和 $(level[ 3]).hide()
或者您可以使用类似的库: http://nivo.dev7studios.com/#usage
这里有更多:http://vandelaydesign.com/blog/web-development/jquery-image-galleries/
well I would suggest something diffrent from the above solution.. Extend the jquery library so that you can initilize it with a bunch of classes that you need to hide/display depending on the slider level.
The extension will accept an array of different classes that are given to your various divs
say
var level= ['.div1','.div2','.div3']
now based on where the slider is you will hide/show that div.
thus if the slider is at 2 then you do something like
$(level[2]).show()
and$(level[1]).hide() and $(level[3]).hide()
or you can use a library like: http://nivo.dev7studios.com/#usage
here are some more: http://vandelaydesign.com/blog/web-development/jquery-image-galleries/