Solved

jQuery loop and target a specific <li>

Posted on 2011-02-14
3
391 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
ID: 34893833
rather than 3, make it n+3.
where n starts from 0, and increments everytime you scroll.
0
 

Author Comment

by:gvilla23
ID: 34893933
Can you elaborate with some code, please?
0
 
LVL 40

Accepted Solution

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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

772 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