Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
more than one elements with same class gsap

I'm working on GSAP and I have two elements in different pages have the same class and I want to apply on them animation using scrollTrigger when I reach to the element, so if there a way I can do this in on function instead of given to them a specific class and repeating my self?

here is my code:

HTML:

 <div class="container"></div>
    <div class="containe">
        <img class="image" src="./card-1.png" alt="">
    </div>
    <div class="container">
        <img class="image" src="./card-2.png" alt="">
    </div>

CSS:

.container{
 height: 100vh;
}

GSAP:

gsap.to('.image' ,{
    x:500,
    rotation:250,
    duration:1,
    opacity:1,
    scrollTrigger:{
        trigger:'.image',
        start:'top center',
        toggleActions:'restart none none none',
    }
})

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!