Solved

jQuery loop and target a specific <li>

Posted on 2011-02-14
3
393 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

Title # Comments Views Activity
React or Angular? 6 81
Client Validating 2 date fields, required & comparison 1 42
How to refresh a page from a sub domain in ajax ? 34 26
JQuery Search Filter 2 40
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…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

820 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