IE JQuery 多Tab iframe 關閉Tab導致游標丟失

來源:互聯網
上載者:User

項目中使用DWZ作為jq架構,因為之前開發的東西都在傳統的webform上,所以使用了大量的iframe,用其openExternal函數實現多Tab.

開發中還好,使用中發現,在ie下,如果一個Tab頁下再開啟一個Tab頁,然後提交後調用closeCurrentTab的方式,結果游標就死活找不回來,只能用Tab鍵才能找回。

然後就開始茫茫的baidu,發現和我一樣用法的人很少,哎,土人,跟不上時代。

終於,被我看到了一個和我一樣用法的人,可惜人家不是用dwz,只是講到這其實是IE的bug。

現象如下:

 架構內嵌iframe點擊事件彈出層,彈出層又嵌套iframe,當彈出層iframe裡面input獲得游標後,刪除彈出層(用的是jQuery.remove(),#.parentNode.removeChild(#)也測試不行),架構內嵌iframe的input獲不得焦點了。

解決辦法: 
先刪除iframe,再刪除彈出層。

 

因此,我們要修改dwz.navTab.js的_closeTab方法,然後IE就沒bug了。 

 _closeTab: function (index, openTabid) {        var iOpenIndex = this._indexTabId(openTabid);        var $panel = this._getPanels().eq(iOpenIndex);        $panel.find("iframe").remove();        CollectGarbage();        this._getTabs().eq(index).remove();          this._getPanels().eq(index).trigger(DWZ.eventType.pageClear).remove();        this._getMoreLi().eq(index).remove();        if (this._currentIndex >= index) this._currentIndex--;        if (openTabid) {            var openIndex = this._indexTabId(openTabid);            if (openIndex > 0) this._currentIndex = openIndex;        }        this._init();        this._scrollCurrent();        this._reload(this._getTabs().eq(this._currentIndex));    },

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.