Jiew Meng
Jiew Meng

Reputation: 88189

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: absolute;

JS

$wrapper.scrollLeft(itemsPerPage * itemWidth);

But its not scrolling

Upvotes: 0

Views: 2307

Answers (1)

Sarfraz
Sarfraz

Reputation: 382606

You will have to use animate method for that:

$wrapper.animate({scrollLeft: itemsPerPage * itemWidth});

Upvotes: 1

Related Questions