A
A
Aleksandr2018-04-17 19:05:24
JavaScript
Aleksandr, 2018-04-17 19:05:24

Script from jQuery to Vue?

There was a task - to transfer the page to vue js,
moreover, they said to connect jq and transfer all scripts. But, and then I want to completely transfer to vue.
And then I ran into difficulty, there is an animation script written in Jq
How can it be translated into vue?

function next(len) {
        var i = -1;
        return function () {
            i++;
            return i == len ? -1 : i;
        };
    }

    $('.main__block').hover(
        function () {
            var $circle = $(this).find('.circle');
            var pos = next($circle.length),
                current,
                timer = setInterval(function () {
                    current = pos();
                    current == -1 ? clearInterval(timer) : $circle.eq(current).addClass('active')
                }, 100);
        }, function () {
            var $circle = $(this).find('.circle');
            var pos = next($circle.length),
                current,
                timer = setInterval(function () {
                    current = pos();
                    current == -1 ? clearInterval(timer) : $circle.eq(current).removeClass('active')
                }, 100);
        }
    );

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lavezzi1, 2018-04-17
@Sashjkeee

https://ru.vuejs.org/v2/guide/transitions.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question