@drtvader
Вечный студент

Как анимировать смену атрибутов?

Привет!
Подскажите пожалуйста, как можно анимировать смену изображений?
weight.on("click", function() {
            var dataPrice = $(this).attr('data-price');
            $(this).parents('.js-product-item').find(price).html(dataPrice);
            $(this).parents('.js-product-item').find('.js-price').removeClass('active-link');
            $(this).addClass('active-link');
            $(this).parents('.js-product-item').find('.js-weight-img').attr('src', $(this).attr('data-image') );
        });

Пытался классами, но выходит плохо.
  • Вопрос задан
  • 88 просмотров
Решения вопроса 1
@drtvader Автор вопроса
Вечный студент
weight.on("click", function() {
            var dataPrice = $(this).attr('data-price');
            $(this).parents('.js-product-item').find(price).fadeOut(500, function (){
                $(this).html(dataPrice);
                $(this).fadeIn(500);
            });
            $(this).parents('.js-product-item').find('.js-price').removeClass('active-link');
            $(this).addClass('active-link');
            var src = $(this).attr('data-image');
            $(this).parents('.js-product-item').find('.js-weight-img').fadeOut(300, function (){
                $(this).attr('src', src );
                $(this).fadeIn(300);
            });
      });
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

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

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