Solved

jQuery loop and target a specific <li>

Posted on 2011-02-14
3
388 Views
Last Modified: 2012-05-11
So I have a list item with 10 items in it, I have them in a carousel.

The carousel has only 5 of the <li> viewable and in those I want to target the middle one, even when some some scrolls the carousel.

I can target the third one like this $("ul li:nth-child(3)"), but when I scroll the third <li> moves in the direction of the carousel, I need it fixed on the third viewable <li>.

Thanks,
0
Comment
Question by:gvilla23
  • 2
3 Comments
 
LVL 40

Expert Comment

by:gurvinder372
Comment Utility
rather than 3, make it n+3.
where n starts from 0, and increments everytime you scroll.
0
 

Author Comment

by:gvilla23
Comment Utility
Can you elaborate with some code, please?
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
Comment Utility
sure i can plug the same in your carousel code you are using. Please share the same
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

771 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

11 Experts available now in Live!

Get 1:1 Help Now