Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7827983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:07:11+00:00 2026-06-02T10:07:11+00:00

I am trying to make only the li:nth-child(2) width animate from 230px to 780px

  • 0

I am trying to make only the li:nth-child(2) width animate from 230px to 780px.

I have done this, but now whenever there is a li within this section it then gives the nth-child(3) that width of 780px also.

How do I only affect the width of the one element I am trying to?

JS :

$(document).ready(function(){
    $("#getsocial").live('click', function(){
        $(".homepage li:nth-child(1)").fadeOut(1000);
        $(".homepage li:nth-child(3)").fadeOut(1000);
        $(".homepage ul > li:nth-child(2)").fadeOut(1000).delay(300).fadeIn(1000).animate({width:'780px'},1000);
        $(".socialshare").hide().delay(2400).fadeIn(1000);
        $(".goback").hide().delay(2400).fadeIn(1000);
    });
});

I have also tried this:

$(document).ready(function(){
    $("#getsocial").live('click', function(){
        $(".homepage li:nth-child(1)").fadeOut(1000);
        $(".homepage li:nth-child(3)").fadeOut(1000);
        $(".homepage li:nth-child(2)").fadeOut(1000).delay(300).fadeIn(1000).animate({width:'780px'},1000);
        $(".socialshare").hide().delay(2400).fadeIn(1000);
        $(".goback").hide().delay(2400).fadeIn(1000);
    });
});

HTML :

<div class="homepage">
  <ul>
    <li>content here</li>
    <li>
      <ul>
        <li>content here</li>
        <li>content here</li>
        <li>content here</li>
      </ul>
    </li>
    <li>content here</li>
  </ul>
</div>

Thanks in advance for the help given 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:07:13+00:00Added an answer on June 2, 2026 at 10:07 am

    Use this selector instead:

    .homepage > ul > li:nth-child(2)
    

    This will work for the html you have posted above, because now it will only work on a ul that is a direct descendent of <div class="homepage"> and therefore not your sub ul.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a toggle function work, but since I have only
I am trying to make this landscape only iphone app. I only use this
I'm trying to make a JSpinner that will only accepts numbers but I also
Im trying to make the divs change class from normal to thin ONLY if
i'm trying to make toggling div with only 1 javascript. I tried this, the
I'm trying to make an AutoHotKey macro that's active only in Windows Explorer but
I'm trying to make only one query out of the following, but can't find
i'm trying to make a web only using couchdb and couchapp... but for some
I am trying to make this layout with Twitter Bootstrap (only the boxes) :
I am trying to make a Numeric only TextBox in WPF and I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.