javascript - Laravel/Slick:未捕获的 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。这将解决错误。
推荐阅读
- java - 如果 jsonArray 的数组为空,为什么 Jsonpath 不返回空?
- python - PyQt 和 OpenCV 干扰
- javascript - 在移动设备上水平滚动页面和加速
- python-3.x - 无法使用核心 tensorflow api 为张量“Placeholder_1:0”提供形状 (242,) 的值
- xamarin.android - 如何在 Visual Studio 2019 中定位 Android 4.1?
- ios - 获取 imagePaths 的所有资产
- javascript - 向站点添加了一些代码,它可以正常工作,但似乎无限滚动到页脚之外
- php - 使用 POSTMAN 测试 Laravel API 路由
- c# - 如何在 C# 中使用 Process.Start 传递 argv[0]
- c# - 具有相同类和相同类列表的 C# 泛型