ECSHOP中transport.js和jquery的衝突的簡單解決辦法

來源:互聯網
上載者:User

標籤:add   特效   執行個體   header   使用   syntax   alt   pac   解決   

ECSHOP中transport.js和jquery的衝突的簡單解決辦法

一流資源網近日在ECSHOP網站加入了幾個JS特效代碼,在Google、Firefox下正常,在各版本IE下都不常,左思不得其解。

最後才知道原來是“ECSHOP中transport.js和jquery的衝突”

因為通用頭部檔案中引用了

1 {insert_scripts files=‘transport.js,utils.js‘}

transport.js與jquery有衝突。原因不多講。在網上找到一個最簡單解決辦法:

成功了,請評論歡呼!!!

如果失敗了,請重頭再來,肯定哪裡操作不對。

 

一、在 page_header.lbi 庫檔案中加入如下代碼,注意操作順序:

1、先匯入transport.js 檔案

1 {insert_scripts files=‘transport.js,utils.js‘}

2、然後匯入您網站使用的jquery檔案:

1 <script language="javascript" src="您的jquery存放路徑"></script>

3、加入代碼:

123456 <script type="text/javascript">$(function() {window.__Object_toJSONString = Object.prototype.toJSONString;delete Object.prototype.toJSONString;});</script>

注意引用順序,不能亂!

 

執行個體:

比如,我只有ECSHOP首頁才會有衝突。所以我直接在 index.dwt 檔案中</head>區加入以下代碼:

123456789 {insert_scripts files=‘transport.js,utils.js‘}<script type="text/javascript" src="themes/68ecshop_yixunfree/js/jquery-1.4.2.min.js"></script>{insert_scripts files=‘niuzai/jquery-1.8.3.js‘}<script type="text/javascript">$(function() {window.__Object_toJSONString = Object.prototype.toJSONString;delete Object.prototype.toJSONString;});</script>

為了避免影響其它頁面,我是重新複復制一個頭部庫檔案 page_header_indtx.lbi 檔案。把裡面的

{insert_scripts files=‘transport.js,utils.js‘}  刪除,如以上代碼,直接加在 index.dwt中

ECSHOP中transport.js和jquery的衝突的簡單解決辦法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.