开发者

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});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜