Answer the question
In order to leave comments, you need to log in
How to make slides change automatically?
Guys, help! It is necessary to make automatic scrolling of the slider on jquey I have
already tried a lot of things, nothing works, but in jquey I am not very savvy
jQuery(function ($) {
var degree = 0;
function rotateElem(elem) {
var indexCurent;
var countElem = $('.circle-container .circle-item').length;
var indexElem = $('.circle-container .circle-item').index(elem);
$('.circle-container .circle-item').each(function (index) {
if ($(this).hasClass('selected')) {
indexCurent = index;
}
});
$('.circle-container .circle-item.selected').removeClass('selected');
if (indexCurent < indexElem) {
degree = degree - ((360 / countElem) * (indexElem - indexCurent));
}
if (indexCurent > indexElem) {
degree = degree + ((360 / countElem) * (indexCurent - indexElem));
}
$('.circle-container').css({
'-webkit-transform': 'rotate(' + degree + 'deg)',
'-moz-transform': 'rotate(' + degree + 'deg)',
'-ms-transform': 'rotate(' + degree + 'deg)',
'-o-transform': 'rotate(' + degree + 'deg)',
'transform': 'rotate(' + degree + 'deg)'
});
elem.addClass('selected');
}
$('.circle-container .circle-item').on('click', function (e) {
e.preventDefault();
var elem = $(this);
rotateElem(elem);
appendContent(elem);
});
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question