Easyslider 的 JavaScript 问题
首先访问此页面并将鼠标悬停在菜单上: http://milabalami.com/saved/2/index.php
然后访问此Wordpress我在其中实现了完全相同的代码的页面: http://milabalami.com
当您将鼠标悬停在 Wordpress 菜单上时,您会看到滑块没有显示。为什么?我可以看到该页面给出了一条错误消息:
$ is not a function
http://miladalami.com/wp-content/themes/sandbox/js/custom.js
为什么会这样?它与在其他页面上完美运行的代码完全相同。我不明白为什么它在 WordPress 页面上给出该错误,而不是在滑块工作的另一个页面上给出该错误。谁能帮我解决这个难题?
蒋易解开了谜题。
First visit this page and hover your mouse over the menu:
http://milabalami.com/saved/2/index.php
Then visit this Wordpress page where I have implemented the exact same code:
http://milabalami.com
When you hover your mouse over the Wordpress menu, you will see that the slider does not show up. Why? I can see that the page gives an error stating:
$ is not a function
http://miladalami.com/wp-content/themes/sandbox/js/custom.js
Why is that? Its the exact same code that worked perfectly on the other page. I dont understand why it is giving that error on the Wordpress page, and not on the other one where the slider works. Anyone that could assist me in solving this puzzle?
Puzzle solved by Yi Jiang.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来好像在这个过程中的某个地方,
$
被覆盖了。不过,您仍然可以使用您的代码,只需使用jQuery
而不是$
-不过,这是一种权宜之计。您应该将所有代码合并到一个文件中,而不是像现在一样将它们分开,并减少对插件的依赖。
It looks like somewhere along the way, the
$
got overridden. You can still use your code, however, by usingjQuery
instead of$
-It's a stopgap measure, however. You should combine all your code into a single file, instead of separating them out like they are right now, and reduce your dependency on plugins.