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

前端 未结 15 1586
独厮守ぢ
独厮守ぢ 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/

提交回复
热议问题