Solved

Jquery scroll maximum

Posted on 2010-08-20
5
481 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Multiple of Image Swaps 5 42
Date Picker is picky (about something) 4 42
Pass a js value to an html form 5 43
Secure registration PHP 7 43
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

752 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