0
Good afternoon,
I would like to convert this code below to Javascript:
$('.circles > div').click(function () {
let index = $('.circles > div').index(this);
$('.circles > div').removeClass('active');
$(this).addClass('active');
$('.steps-carousel').css('transform', 'translateX(' + (index * -20) + '%)');
});
Someone could help me?
Have you tried anything? Do you understand this jQuery code and what it does? What lines don’t you understand?
– Sergio
This code was a Steps I created with a Carousel, but I created it in Jquery and where I will deploy does not use Jquery.
– Diogo Silva
What it does: When I click on the circle, it removes the active class and adds in the circle I clicked and changes the Carousel item. Only it doesn’t work because in the system that I’m going to deploy, it doesn’t have Jquery, so it has to be pure javascript
– Diogo Silva
You know for example what
$('.circles > div').index(this);
ago?– Sergio
Come on: , within the "Circles" class, has Ivs with no class or id, just div. , this "$('.Circles > div'). index(this);" stores within the index variable (Let index) the div I clicked on.
– Diogo Silva