Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

73
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda