this is the code I have for an image slider:
jQuery(document).ready(function($) {
counter = 0;
$(“.cover-slider > i:last”).click(nextSlide);
$(“.cover-slider > i:first”).click(function () {
counter–;
let images = $(“.cover-slider > img”);
let activeSlide = $(“.active”);
activeSlide.removeClass(“active”).addClass(“inactive”);
if (counter == -1) counter = 2;
images.eq(counter).addClass(“active”).removeClass(“inactive”);
});
})
function nextSlide () {
counter++;
let images = $(“.cover-slider > img”);
let activeSlide = $(“.active”);
activeSlide.removeClass(“active”).addClass(“inactive”);
if (counter == 3) counter = 0;
images.eq(counter).addClass(“active”).removeClass(“inactive”);
}
The first $ in nextSlide is giving an error of undefined. I guess it conflicts with other libraries. What can I do to solve this? I need nextSlide to be a global function so I can use a setInterval function.
[ad_2]