Jump to content
Search Community

this sample bug me and change my webpage li every time, how can I fix this?

idarfan test
Moderator Tag

Go to solution Solved by Jonathan,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

  • Solution

Hello idarfan, and welcome to the GreenSock forum

 

Change the below on line 8 in that codepen demo:

$list = $("li"),

to this:

$list = $("#panel3 li"),

What was happening was the $("li") jQuery collection wrapper, was selecting all li tags on the page. By adding #panel13 li you make sure that only the li tags that are a children of the #panel13 div are selected.

<div class="panel" id="panel3"> <!-- parent -->
    <div id="info">
      <h1>Burger Boy</h1>
      <ul>
        <li>Free delivery in NYC</li> <!-- child -->
        <li>Open 24hrs</li> <!-- child -->
      </ul>
      <div id="orderNow">order now</div>
    </div>
</div>

Also you could try the folowing code, forked from that original GreenSock codepen, with the change above:

 

See the Pen wKaLEJ by jonathan (@jonathan) on CodePen

 

Does that help? :)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...