Looking to dynamically change the background image in CSS based on the active slide value in Glider.js
Here is the CSS:
html {
background-image: url("https://images.unsplash.com/photo-1496518908709-02b67989c265?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60");
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
I am using Glider.js, so when the current slide is in frame, the class glide__slide--active is added to the <li> element.
<div class="glide__track" data-glide-el="track">
<ul class="glide__slides">
<li class="glide__slide" data-image-value="https://bob.com/image/bigimage1.jpg">01</li>
<li class="glide__slide glide__slide--active" data-image-value="https://bob.com/image/bigimage2.jpg" >02</li>
<li class="glide__slide" data-image-value="https://bob.com/image/bigimage3.jpg">03</li>
</ul>
</div>
Therefore, I need to update the URL of the background image using jQuery with the value from data-image-value.