简体   繁体   English

如何将jQuery文件添加到导航网站?

[英]How to add jQuery file to navigation website?

I am working with this demo: http://cssdeck.com/labs/setting-active-states-on-sticky-navigations-while-scrolling/ 我正在使用此演示: http : //cssdeck.com/labs/setting-active-states-on-sticky-navigations-while-scrolling/

For some reason when I try to recreate it the Java part making the navigation work isn't coming through on my version here: http://cssdeck.com/labs/ydsxavxy 由于某些原因,当我尝试重新创建它时,使导航正常工作的Java部分在我的版本中未通过: http : //cssdeck.com/labs/ydsxavxy

So far I saved out index.html, style.css, and flip.js and attempted to link the CSS and JS in the index. 到目前为止,我保存了index.html,style.css和flip.js,并尝试在索引中链接CSS和JS。

How can I get my version working like the demo? 如何使我的版本像演示一样工作? How is a Java file included outside of CSSDeck? CSSDeck之外如何包含Java文件? I am not too familiar with how CSSDeck takes the HTML, CSS, and Java and combines them into one page preview. 我不太熟悉CSSDeck如何采用HTML,CSS和Java并将它们组合成一页预览。

The version of jQuery you are loading is not correct. 您正在加载的jQuery版本不正确。

The example that works uses 1.8 , and you are loading 1.4 : 有效的示例使用1.8 ,并且您正在加载1.4

<script class="cssdeck" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>

You can easily know this by looking at your browser console and seeing what errors it's throwing. 您可以通过查看浏览器控制台并查看抛出的错误来轻松了解这一点。 In your case, the error is as follows: 在您的情况下,错误如下:

TypeError: $(...).on is not a function

This usually means your jQuery library is not defined or not supported by the code you're using. 这通常意味着您使用的代码未定义或不支持您的jQuery库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM