jQuery scrollLeft
I was looking at the tutorial at http://jqueryfordesigners.com/jquery-infinite-carousel/. I tried creating something similar myself for understanding, it turned out to be more complex than I thought. How do I use scrollLeft?
I created a simple fiddle to test it http://jsfiddle.net/sryKu/2/
<div id="carousel">
<div class="wrapper">
<ul>
<li><a href="#">Test Link 1</a></li>
<li><a href="#">Test Link 2</a></li>
...
CSS
#carousel .wrapper {
position: relative;
ul {
position: 开发者_如何学JAVAabsolute;
JS
$wrapper.scrollLeft(itemsPerPage * itemWidth);
But its not scrolling
You will have to use animate
method for that:
$wrapper.animate({scrollLeft: itemsPerPage * itemWidth});
精彩评论