@IgorUstimkmenko
Немного фронт-ендер

Как сделать, чтобы слайды менялись автоматически?

Ребят, помогите! Необходимо сделать автоматическое перелистывание сладера на jquey
Уже много что перепробовал, ничего не работает, а в jquey не очень шарю
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);
    });

})








  • Вопрос задан
  • 60 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы