2
<default>
<reference name="head">
<action method="addJs"><js>splurgyjs/jquery-1.7.2.min.js</js></action>
</reference>
</default>
这是在我的布局文件夹hello.xml
如何在管理员端使用jQuery而不使用其他所有模块?
所以,问题是,我创建了一个新的导航标签与使用jQuery的一个页面,它完美的作品我的自定义模块页面上。但是,jQuery会在其他所有页面上打破其他所有内容,如菜单停止工作,并且存在冲突。我如何才能在我的页面上显示布局,或者如何在没有冲突的情况下包含jQuery?
更新,我想汤姆的建议:
在config.xml中:
<layout>
<updates handle="index_settings">
<embeds>
<file>justin.xml</file>
</embeds>
</updates>
</layout>
在justin.xml:
<justin_index_settings>
<reference name="head">
<action method="addItem">
<type>js_css</type>
<name>justin/style.css</name>
</action>
</reference>
</justin_index_settings>
您是否在某处添加了'jQuery.noConflict()?如果没有,请添加它。 Magento完全基于原型,它已经使用'$',因此与jQuery的'$'版本冲突。这可能是你的问题。 – 2012-08-03 22:02:05
我只将它添加到我有我自己的jQuery的文件中 – Strawberry 2012-08-03 23:36:07
对于'$'问题就足够了。所以你可以把它拿出来。您可以将''移动到自定义的句柄中,并在'hello.xml'中的每个''中执行'。当你注意到将它放在''中时,它不会加载你的模块中的所有页面,而是通过系统中的所有页面加载。 –
2012-08-04 08:09:27