Slick Carousel Uncaught TypeError: $(…).slick is not a function

前端 未结 15 1546
独厮守ぢ
独厮守ぢ 2020-12-10 00:18

Somehow I\'m unable to use slick carousel (http://kenwheeler.github.io/slick/) correctly.

I\'m getting the following error:

Uncaught TypeError: $(..         


        
相关标签:
15条回答
  • 2020-12-10 01:17

    Recently had the same problem: TypeError: $(...).slick is not a function

    Found an interesting solution. Hope, it might be useful to somebody.

    In my particular situation there are: jQuery + WHMCS + slick. It works normal standalone, without WHMCS. But after the integration to WHMCS an error appears.

    The solution was to use jQuery in noConflict mode.

    Ex: Your code:

    $(document).ready(function() { 
      $('a').click( function(event) {
        $(this).hide();
        event.preventDefault();
      });
    });
    

    Code in noConflict mode:

    var $jq = jQuery.noConflict();
    $jq(document).ready(function() { 
      $jq('a').click( function(event) {
        $jq(this).hide();
        event.preventDefault();
      });
    });
    

    The solution was found here: http://zenverse.net/jquery-how-to-fix-the-is-not-a-function-error-using-noconflict/

    0 讨论(0)
  • Thought this would be helpful for others with the same issue, as I've seen a few on here - I ran into this, but found I loaded slick.js AFTER my main.js (which was calling the slick() function). swapped the two and it works great

    0 讨论(0)
  • 2020-12-10 01:18

    In my instance the solution was moving the jQuery include just before the </head> tag. With the Slick include at the bottom before the </body> and just before my script include that initiates the slider.

    0 讨论(0)
提交回复
热议问题