Jump to content
Search Community

How to select certain elements of group of element

OrhanOzkercin test
Moderator Tag

Recommended Posts

Hello, I'm really new with Gsap and now I have a problem with choosing certain dom element. I have 3 div with same children and I want to animate those children but when I chose childrens classname it animates all children. I want to animate only div that has also  active class. 

 I added similar example. I just want to animate active parants children.

 

 

See the Pen KKzdLME by Orhando (@Orhando) on CodePen

Link to comment
Share on other sites

4 minutes ago, Dipscom said:

Hi OrhanOzkercin,

 

Welcome to the forums!

 

You're almost there. If you want to target only the children of the element that has the ".active" class on it, you need to specify it on the CSS selector.

 


gsap.from('.active *', {...})

 

Here's a handy list of selectors for you: https://www.w3schools.com/cssref/css_selectors.asp

Thank you, I was not aware that we could write regular css selectors like this one. This was kind a silly question, sorry for that.  

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...