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