@DanilChekh

Как использовать mixitup и jquery вместе?

Подскажите, на странице возникает ошибка Uncaught TypeError: $(...) is not a function , это если на вордпресс хостинге,на локальном все работает правильно,погуглил пишут что конфликт бибилиотек, как это исправить?Код js
<script type="text/javascript">
  $(function () {
 
    var filterList = {
 
      init: function () {
        $('#portfoliolist').mixitup({
          targetSelector: '.portfolio',
          filterSelector: '.filter',
          effects: ['fade'],
          easing: 'snap',
          // call the hover effect
          onMixEnd: filterList.hoverEffect()
        })    
 
      },
 
      hoverEffect: function () {
 
        $('#portfoliolist .portfolio').hover(
          function () {
            $(this).find('.label').stop().animate({bottom: 0}, 200, 'easeOutQuad');
            $(this).find('img').stop().animate({top: -30}, 500, 'easeOutQuad');       
          },
          function () {
            $(this).find('.label').stop().animate({bottom: -40}, 200, 'easeInQuad');
            $(this).find('img').stop().animate({top: 0}, 300, 'easeOutQuad');               
          }   
        );        
 
      }
 
    };
    filterList.init();  
  }); 
</script>

Просто в верстке все работает правильно,а вот на сайте уже нет,
  • Вопрос задан
  • 855 просмотров
Пригласить эксперта
Ответы на вопрос 1
deniscopro
@deniscopro Куратор тега WordPress
WordPress-разработчик, denisco.pro
Попробуйте так:

(function ($) {
    $(document).ready(function () {
		var filterList = {
		 
			  init: function () {
				$('#portfoliolist').mixitup({
				  targetSelector: '.portfolio',
				  filterSelector: '.filter',
				  effects: ['fade'],
				  easing: 'snap',
				  // call the hover effect
				  onMixEnd: filterList.hoverEffect()
				})    
		 
			  },
		 
			  hoverEffect: function () {
		 
				$('#portfoliolist .portfolio').hover(
				  function () {
					$(this).find('.label').stop().animate({bottom: 0}, 200, 'easeOutQuad');
					$(this).find('img').stop().animate({top: -30}, 500, 'easeOutQuad');       
				  },
				  function () {
					$(this).find('.label').stop().animate({bottom: -40}, 200, 'easeInQuad');
					$(this).find('img').stop().animate({top: 0}, 300, 'easeOutQuad');               
				  }   
				);        
		 
			  }
		 
		};
		filterList.init();  
    });
})(jQuery);
Ответ написан
Комментировать
Ваш ответ на вопрос

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

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