无法让 magnific popup 工作,两个 javascript 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24444807/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't get magnific popup to work, two javascript errors
提问by Bowea
I am trying to make a lightbox gallery and have used the example source code.
我正在尝试制作一个灯箱画廊并使用了示例源代码。
Here is the documentation I read over: http://dimsemenov.com/plugins/magnific-popup/documentation.html
这是我阅读的文档:http: //dimsemenov.com/plugins/magnific-popup/documentation.html
Uncaught TypeError: undefined is not a function
Uncaught ReferenceError: $ is not defined
I am not sure what the errors mean or what to do with them.
我不确定这些错误是什么意思或如何处理它们。
In a video tutorial I watched, they said something about a jquery conflict being a potential problem. On a different page of the website, I used a Kwicks sliding menu (which also used jquery). That's the only thing I can think of.
在我观看的视频教程中,他们说 jquery 冲突是一个潜在问题。在网站的另一个页面上,我使用了 Kwicks 滑动菜单(也使用了 jquery)。这是我唯一能想到的。
I would really appreciate any help you would be able to give me!
我真的很感激你能给我的任何帮助!
Thank you! There are no more errors, but now I need to make the hovering on the image work with the zooming in magnifying cursor.
谢谢!没有更多的错误,但现在我需要通过放大放大光标使悬停在图像上工作。
I have made the hovering work, now I need to make the zooming in magnifying cursor work. I have attached a page of what I what the cursor to be when it hovers.
我已经完成了悬停工作,现在我需要使放大光标的放大工作。我附上了一个页面,说明光标悬停时的内容。
Example: http://dimsemenov.com/plugins/magnific-popup/
示例:http: //dimsemenov.com/plugins/magnific-popup/
I have figured out the zoom cursor! Thanks for all the help!
我已经找到了缩放光标!感谢所有的帮助!
回答by Shaunak D
The documentation of the plugin Magnific popup you are using suggests -
您正在使用的插件Magnific popup的文档建议-
Including files
包括文件
<!-- jQuery 1.7.2+ or Zepto.js 1.0+ -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- Magnific Popup core JS file -->
<script src="magnific-popup/jquery.magnific-popup.js"></script>
Remember: You need to include jQuery file reference, for the plugin to work; rather every jQuery plugin. And in the specified order. This is the sole reason behind $ not defined
and undefined in not a function
.
记住:你需要包含 jQuery 文件引用,插件才能工作;而是每个 jQuery 插件。并按照指定的顺序。这是$ not defined
和背后的唯一原因undefined in not a function
。