mamp wordpress jquery 问题。他们不工作
我的 jQuery 函数正在触发,但它们都无法通过普通的 WordPress 安装运行。还有其他人遇到过这个问题吗?
展示这样的示例将非常具有挑战性,因为它是通过框架运行的。
我有一个名为“main.js”的外部 JS 脚本:
<script src="<?php bloginfo('template_directory'); ?>/js/jquery-1.4.4.min.js" type="text/javascript" charset="UTF-8"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/main.js" type="text/javascript" charset="UTF-8"></script>
$(document).ready(function() {
foo1('.foo1',500);
$(".foo2").foo2({
// foo2
});
});
function foo1(e,s) {
// foo1
}
这是正常设置,在托管时可以正常工作。只是在本地主机上,由于某种原因它无法工作。是否有需要设置的 MAMP (OSX) 设置。
My jQuery functions are firing but none of them are working through a vanilla wordpress install. Has anyone else had this problem?
To show an example of this would be quite challenging since it's running through a framework.
I have an external JS script called 'main.js':
<script src="<?php bloginfo('template_directory'); ?>/js/jquery-1.4.4.min.js" type="text/javascript" charset="UTF-8"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/main.js" type="text/javascript" charset="UTF-8"></script>
$(document).ready(function() {
foo1('.foo1',500);
$(".foo2").foo2({
// foo2
});
});
function foo1(e,s) {
// foo1
}
It's normal setup an working when hosted. It's just on localhost that it isn't working for some reason. Is there a MAMP (OSX) setting that needs to be setup.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 js 库冲突,“$”符号在 WordPress 内部不起作用。尝试使用 $.noConflict 来解决此问题,语法如下:
The '$' sign does not work inside of wordpress by because of conflicting js libraries. Try using $.noConflict to address this problem by using the syntax below: