Solved

Jquery scroll maximum

Posted on 2010-08-20
5
474 Views
Last Modified: 2012-08-13
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>
0
Comment
Question by:maccaj51
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 33483268
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
0
 

Author Comment

by:maccaj51
ID: 33483306
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>
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 33483331
Yes, if you just want to go to last item, it should work

If you want to go to nth item, then consider this
http://api.jquery.com/nth-child-selector/
0
 

Author Comment

by:maccaj51
ID: 33483388
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>

?


0
 

Author Closing Comment

by:maccaj51
ID: 33723717
sorted it eventually
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now