admin管理员组文章数量:1394534
I'm trying out using scrollspy with bootstrap, and I'm running into some errors with it. The error console keeps returning this: TypeError: 'undefined' is not an object (evaluating '$.fn')
, on line 124 of bootstrap-scrollspy.js, which is this line
var old = $.fn.scrollspy
, which is under the ScrollSpy Plugin Definition. I am using the code directly taken from this jsFiddle
Does anyone know why this is happening?
I'm trying out using scrollspy with bootstrap, and I'm running into some errors with it. The error console keeps returning this: TypeError: 'undefined' is not an object (evaluating '$.fn')
, on line 124 of bootstrap-scrollspy.js, which is this line
var old = $.fn.scrollspy
, which is under the ScrollSpy Plugin Definition. I am using the code directly taken from this jsFiddle
Does anyone know why this is happening?
Share Improve this question edited Aug 1, 2013 at 13:27 Noich 15.5k15 gold badges65 silver badges93 bronze badges asked Aug 1, 2013 at 13:22 scrblnrd3scrblnrd3 7,4249 gold badges36 silver badges65 bronze badges 1- 3 Did you import jQuery before this line? – colestrode Commented Aug 1, 2013 at 13:29
2 Answers
Reset to default 8I would double check two things:
- Make sure you're including jQuery before you're including Bootstrap on the page.
- Make sure no other libraries (e.g., prototype) are overriding the
$
variable.
On your script line I assume you have removed "slim" from jQuery include. But did you remove the "integrity" checksum? if not, the integrity check is failing, and jQuery isn't loading.. (I just had this same issue).
for example this:
<script src="https://code.jquery./jquery-3.3.1.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
should be
<script src="https://code.jquery./jquery-3.3.1.min.js" crossorigin="anonymous"></script>
本文标签: javascriptfn is not an objectStack Overflow
版权声明:本文标题:javascript - $.fn is not an object - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744100747a2590861.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论