dongpeng8994 2014-09-25 09:42
浏览 31

在magento中使用jquery库会与prototype.js发生冲突

Confused Using jquery lib with magento

I am working on magento.Magento uses prototype.js, i am in need of working jquery events so many situations i have to include some jquery,jquery.min and jquery-ui lib files for my work.

it always produce conflicts even for normal click events..

So How i can use jquery with magento, and Which lib file is best to work on magento? What i have to understand to use jquery with magento?

Please help me anyone, to understand the scenario...

  • 写回答

1条回答 默认 最新

  • doukuiqian9911 2014-10-01 19:16
    关注

    You can use any js library, first of all you need to include yout library in the xml file from your theme, it depends on your theme witch xml you should use, upload the library to your js theme folder.

    <action method="addItem"><type>skin_js</type><name>js/jquery.js</name></action>
    

    Then in your jQuery add this snipped:

    var $j = jQuery.noConflict();
    

    Clear cache and try it.

    You can try one last thing in your local.xml add this:

    <default>
        <reference name="head">
            <block type="core/text" name="jquery.by.google">
                <action method="setText">
                    <text><![CDATA[<script type="text/javascript" src="path/to/google/hosted/jquery"></script><script type="text/javascript">jQuery.noConflict();</script>]]>
                    </text>
                </action>
            </block>
        </reference>
    </default>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝