How to get WordPress not to conflict with $ symbol JQuery

[ad_1]

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]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer