Help me with this javascript

Hi!

Can you help me with the following javascript, doesnt seem to work.

$(function(){
$(’.carousel-item’).eq(0).addClass(‘active’);
var total = $(’.carousel-item’).length;
var current = 0;
$(’#moveRight’).on(‘click’, function(){
var next=current;
current= current+1;
setSlide(next, current);
});
$(’#moveLeft’).on(‘click’, function(){
var prev=current;
current = current- 1;
setSlide(prev, current);
});
function setSlide(prev, next){
var slide= current;
if(next>total-1){
slide=0;
current=0;
}
if(next<0){
slide=total - 1;
current=total - 1;
}
$(’.carousel-item’).eq(prev).removeClass(‘active’);
$(’.carousel-item’).eq(slide).addClass(‘active’);
setTimeout(function(){

  },800);



console.log('current '+current);
console.log('prev '+prev);

}
});

Hello Eyoael,

Please note that debugging custom codes goes beyond the scope of our support. Also, the site that is attached in your license is under a coming soon page so I am not sure what you are trying to use the code for. If you are not sure how to proceed, it would be best to get in touch with a developer to get this sorted.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.