微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Laravel/Slick: Uncaught TypeError: $(...).slick 不是函数

如何解决Laravel/Slick: Uncaught TypeError: $(...).slick 不是函数

我正在尝试使用 Slick 在我的 Laravel 网站上放置一些推荐。我已按照此说明创建推荐:https://codepen.io/mark_sottek/pen/mJdByp

当如上所述添加所有脚本时,我总是收到错误“Uncaught TypeError: $(...).slick is not a function”。

我已经尝试了在这里找到的几种解决方案,但没有一个我有用。

我的代码

<section class="quotes">
    <div class="bubble">
        <blockquote>I refuse to accept the view that mankind is so tragically bound to the starless midnight of racism and war that the bright daybreak of peace and brotherhood can never become a reality... I believe that unarmed truth and unconditional love will have the final word.</blockquote>
        <div></div>
        <cite> Martin Luther King,Jr.</cite>
    </div>
    <div class="bubble">
        <blockquote> Peace is not a relationship of nations. It is a condition of mind brought about by a serenity of soul. Peace is not merely the absence of war. It is also a state of mind. Lasting peace can come only to peaceful people.</blockquote>
        <div></div>
        <cite> Jawaharlal Nehru</cite>
    </div>
    <div class="bubble">
        <blockquote> Forgiveness is not always easy. At times,it feels more painful than the wound we suffered,to forgive the one that inflicted it. And yet,there is no peace without forgiveness.</blockquote>
        <div></div>
        <cite> Marianne Williamson</cite>
    </div>
    <div class="bubble">
        <blockquote>Of all our dreams today there is none more important - or so hard to realise - than that of peace in the world. May we never lose our faith in it or our resolve to do everything that can be done to convert it one day into reality. </blockquote>
        <div></div>
        <cite> Lester B. Pearson</cite>
    </div>
</section>

<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="{{ asset('slick/slick.min.js') }}"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('.quotes').slick({
            dots: true,infinite: true,autoplay: true,autoplaySpeed: 6000,speed: 800,slidesToShow: 2,adaptiveHeight: true
        });
    });
</script>

感谢您的帮助。

更新: 整个错误信息:

Uncaught TypeError: $(...).slick is not a function
    at HTMLDocument.<anonymous> ((index):19)
    at j (jquery-1.11.0.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2)
    at Function.ready (jquery-1.11.0.min.js:2)
    at HTMLDocument.K (jquery-1.11.0.min.js:2)

解决方法

将您的 jquery-1.11.0.min.js 文件更新为较新版本的 jquery。这将解决错误。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。