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

253
Views
animating muliple images using javascript not working swiper slider

i have an image section in my website which is inside a slider, the slider has 4 slides, so now i want to slide that image also , so i did the following code:

function changeStyle() {
  $('.animate-left').removeClass('active')
  setTimeout(() => {
    $('.animate-left').addClass(' active')

  }, 1000)
}
const time = setInterval(changeStyle, 6300)

function changeStyle2() {
  $('.bg-shape').removeClass('bgactive')
  setTimeout(() => {
    $('.bg-shape').addClass('bgactive')

  }, 7000)
}
const time2 = setInterval(changeStyle2, 14000)
#bg1 {
  float: left;
  left: 0;
  background-image: url('assets/slider1.2.png');
}

#bg1.bgactive {
  background-image: url('assets/slider4.2.png');
}
<div class="animate-left active">
  <div class="bg-shape" id="bg1">
  </div>
</div>

this is working fine, now i added the third image and did the following:

function changeStyle3() {
  $('.bg-shape').removeClass('bgactive1')
  setTimeout(() => {
    $('.bg-shape').addClass('bgactive1')

  }, 14000)
}
const time3 = setInterval(changeStyle3, 21000)
#bg1.bgactive {
  background-image: url('assets/slider3.2.png');
}

however the third image doesnt slide or show at all, here is the live link

can anyone please tell me what is wrong in here, thanks in advance

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!