Link to home
Start Free TrialLog in
Avatar of maccaj51
maccaj51Flag for Afghanistan

asked on

Jquery scroll maximum

I have simple scroller that auto slides and moves on click....

But how do i either make it continuous or stop when it gets to the last item...?

<div id="scroller-container">
  <ul id="scroller">
    <li>Test1</li>
    <li>Test2</li>
  </ul>
</div>
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

just the get list item element handle using
http://api.jquery.com/last-child-selector/

then you can scroll that element into view using
http://stackoverflow.com/questions/68165/javascript-to-scroll-long-page-to-div/68671#68671
Avatar of maccaj51

ASKER

would this also work if i have more than two items? e.g.
<div id="scroller-container">
  <ul id="scroller">
    <li>Test1</li>
    <li>Test2</li>
<li>Test3</li>
    <li>Test4</li>
  </ul>
</div>
ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is my current code..

how would i use this...
$('li').last().

and say if last li is at a certain position then hide  class=next

<div id="scroller-container">
  <ul id="scroller">
    <li>Test</li>
    <li>Poo</li>
    <li>Test</li>
    <li>Poo</li>
  </ul>
</div>
<a class="prev">Previous</a> <a class="next">Next</a>

?


sorted it eventually