简体   繁体   English

无法加载JavaScript。 尝试了我能想到的一切

[英]JavaScript not being loaded. Tried everything I can think of

Swimwire.com is no longer loading JavaScript properly since I installed an update to its Social module, JomSocial. Swimwire.com不再正确加载JavaScript,因为我为其社交模块JomSocial安装了更新。 It's something to do with JomSocial, I'm certain, since on the homepage no JavaScript properly works (there's a blue bar along the top that should be clickable and contain the words 'Open Control Panel', but it doesn't load). 我敢肯定,这与JomSocial有关,因为主页上没有JavaScript可以正常工作(顶部有一个蓝色栏,应该可以单击并包含单词“ Open Control Panel”,但不会加载)。 Whereas if I visit a page not displaying JomSocial content the JavaScript will happily load. 而如果我访问未显示JomSocial内容的页面,则JavaScript将很高兴加载。

I got some help with this yesterday but unfortuantely I'm still very stuck. 昨天我对此有所帮助,但不幸的是我仍然很困。 I'm a novice at JavaScript and Safari throws me the error 我是JavaScript的新手,而Safari向我抛出了错误

TypeError: Result of expression '$' [undefined] is not a function. TypeError:表达式'$'的结果[未定义]不是函数。 /modules/mod_rokslideshow/tmpl/slideshow.js:73TypeError: Result of expression '$' [undefined] is not a function. /modules/mod_rokslideshow/tmpl/slideshow.js:73TypeError:表达式'$'的结果[未定义]不是函数。 2/media/system/js/mootools.js:54TypeError: Type error 2 / media / system / js / mootools.js:54TypeError:类型错误

I'm not too sure at all how to interpret this. 我不太确定如何解释这一点。 I'm certain that something in JomSocial is causing a conflict but don't know really how to go about addressing this. 我敢肯定,JomSocial中的某些事情会引起冲突,但实际上不知道如何解决该问题。

Jack 插口

There are multiple libraries which define $ ; 有多个定义$库; I know that jQuery and Prototype do this, not sure about MooTools (which I see in your error message). 我知道jQuery和Prototype可以做到这一点,不确定MooTools(我在您的错误消息中看到了)。 So, based on that message, I can only guess that you have, in one way or another, loaded two libraries which both use $ . 因此,根据该消息,我只能猜测您已经以某种方式加载了两个都使用$库。

The jQuery solution for this is to use noConflict: http://docs.jquery.com/Core/jQuery.noConflict . jQuery的解决方案是使用noConflict: http ://docs.jquery.com/Core/jQuery.noConflict。 Not knowing both sides of the clash, and not being able to access the site myself, that's the best I can do. 我不知道冲突的两面,也无法自己访问该网站,这是我能做的最好的事情。


Edit: Did you try any of the solutions that MooTools suggests? 编辑:您是否尝试过MooTools建议的任何解决方案? http://mootools.net/blog/2009/06/22/the-dollar-safe-mode/ http://mootools.net/blog/2009/06/22/the-dollar-safe-mode/

Your jQuery.noConflict() most likely comes after some other scripts are loaded and attempt to use $ . 您的jQuery.noConflict()最有可能是在加载了其他一些脚本并尝试使用$

Another thing... jQuery.noConflict() may not work if it's included before the other library, as it's in this case. 另一件事...如果jQuery.noConflict()包含在另一个库之前,则可能无法正常工作,因为在这种情况下是这样。

You have to make sure that even if you have jQuery in no conflict mode, that you have MooTools loading first . 您必须确保即使在无冲突模式下使用jQuery,也必须加载MooTools。 If you load jQuery, put it into no conflict mode, then load MooTools, it will fail. 如果加载jQuery,将其置于无冲突模式,然后加载MooTools,它将失败。 I wrote some documentation on this in my book: http://www.packtpub.com/files/learning-joomla-1-5-extension-development-sample-chapter-8-using-javascript-effects.pdf 我在自己的书中写了一些文档: http : //www.packtpub.com/files/learning-joomla-1-5-extension-development-sample-chapter-8-using-javascript-effects.pdf

If you make sure that the following call is made before jQuery gets added to the document, it should load MooTools before jQuery: 如果您确定在将jQuery添加到文档之前进行了以下调用,则应在jQuery之前加载MooTools:

JHTML::_('behavior.mootools');

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

相关问题 调用未定义的PHP函数:尝试了我能想到的一切 - Call to undefined PHP function: tried everything i can think of CodeIgniter:没有加载输入类(或者我认为) - CodeIgniter: Input class not being loaded (or so I think) 当页面被重定向时,如何在正在加载的页面的 innerhtml 中使用 javascript 变量? - As a page is redirected how can I use a javascript variable in the innerhtml of the page being loaded? 找不到类“ HTML”,我已经尝试了所有方法 - Class 'HTML' not found, I have tried everything MethodNotAllowedHttpException出现,我已经尝试了一切 - MethodNotAllowedHttpException appearing and I've tried everything 我只是不能扩展Symfony2 Form类。 尝试了一切 - I just can't extend the Symfony2 Form class. Tried everything 我认为RouteCollection.php第233行中的MethodNotAllowedHttpException一切正确,我认为 - MethodNotAllowedHttpException in RouteCollection.php line 233 EveryThing is correct, I think 如何避免多次加载 jQuery 脚本? - How can I avoid jQuery scripts being loaded multiple times? 无法在Wordpress中增加媒体文件大小限制,尝试了所有操作 - Can't increase media file size limit in Wordpress, tried everything 仅加载资源。 活动在FullCalendar中不起作用 - Resources only loaded. Events not working in FullCalendar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM