Si tengo varios divs en un carrusel y quiero que uno de los divs cambie el fondo de la página, ¿sería eso posible?
mientras el carrusel está EN el div, no flotando o haciendo clic en
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"; });Según los documentos , esto debería funcionar:
$('. carousel').on('afterChange', function(slick, currentSlide){ if (currentSlide===1) { $('body').addClass('specialBG'); } else { $('body').removeClass('specialBG'); } });y luego tenga el estilo listo para la diapositiva especial
body.specialBG { background-color:#333; }