create image slider that shows part of previous and next image

限于喜欢 提交于 2019-12-11 13:57:58

问题


I'm trying to create a slideshow using jQuery (similar to jquery scrollhorz) but I want the previous and next image partly shown.

Right now, what I have, is a div (with overflow hidden) containing all the images I have. When previous or next button is pressed, I animate the whole div either to left or right. The problem is, if I have many images loaded into the div, it becomes laggy and slow.

What is the best design to implement this image slider?


回答1:


Without going into the code required, my suggestion would be to use jquery (or moo if that's your thing) to maintain a div that is three to five images long, and keep a list of urls to all the images you want displayed. When you slide the images left or right, you'll pop off the image on the opposite end and add the appropriate image to the other side.

You could use the same technique to loop through the list seamlessly.




回答2:


Try this.

Hero carousel

It fits your description....Hope it helps out :)

this might be a solution too. http://jsfiddle.net/JCQ6Q/15/
Vote up if it helps you :) all the best



来源:https://stackoverflow.com/questions/9693492/create-image-slider-that-shows-part-of-previous-and-next-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!