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

74
Views
Is it possible to change a page's body background with a jquery slick carousel?

If I have multiple divs in a carousel and want one of the divs to change the page's background, would that be possible?

while the carousel is ON the div, not hovering or clicked on

if ($('.carousel').slick('slickGoTo', 1)){ //if slick is on slide index 1
//change to another page where I've already changed the page's background
                location.href = page location;
//or change the body's background
let body=document.getElementsByTagName("body");
     body.style.background = "image url";
});

Edit: https://jsfiddle.net/milytulip/L27nhvbr/

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Based on the docs, this should work:

$('. carousel').on('afterChange', function(slick, currentSlide){
  if (currentSlide===1) {
     $('body').addClass('specialBG');
  } else {
     $('body').removeClass('specialBG');
  }
});

and then have the style ready for the special slide

body.specialBG {
   background-color:#333;
}
about 4 years ago · Juan Pablo Isaza Report
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!