问题描述
我收到控制台错误:
仅供参考:这是一个使用XML的Blogger模板.
FYI: It is a Blogger template, which uses XML.
我已经包含了这样的文件(仅这两个.js文件):
I have included the files like so (only these two .js files):
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'/>
<script src='https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/noframework.waypoints.min.js'/>
我的jQuery(为清晰起见,删除了更长的脚本):
My jQuery (longer scripts removed for clarity):
<script>
// <![CDATA[
$.noConflict();
jQuery( document ).ready(function( $ ) {
<!-- LET'S ADD SPAN ELEMENT TO WIDGET HEADINGS SO WE CAN DO ACCESSIBILITY & INCLUSIVE DESIGN -->
$('.widget > .title').each(function() { $(this).wrapInner('<span />'); });
<!-- LET'S ADD A CLASS TO THE MAIN MENU WHEN SCROLLING DOWN PAST THE MAIN HEADER -->
$("#main-header").waypoint(function() { $('#main-menu').addClass('hide'); }, { offset: '100%' });
<!-- LET'S MAKE THE PAGE LOADER GO AWAY WHEN PAGE IS LOADED -->
$('#page-loading-cover').delay(1500).addClass('page-loaded');
});
// ]]>
</script>
为什么它不起作用,我该如何解决?
Why is it not working, and how do I fix it?
推荐答案
您添加了独立库( waypoint -注意noframework
部分),而不是jQuery插件( jquery-waypoints ).请参见此CDN列表,然后选择https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js
,即包含
You added the stand-alone library (waypoint — notice the noframework
part), not the jQuery plugin (jquery-waypoints). See this CDN list and pick https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js
, i.e. include
<script src='https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js'/>
代替
<script src='https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/noframework.waypoints.min.js'/>
这篇关于Waypoints.js Waypoint不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!