Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

78
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda