最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

IE11下CKEditor在Bootstrap Modal中下拉問(wèn)題的解決

 更新時(shí)間:2019年09月25日 10:53:36   作者:yulj  
這篇文章主要介紹了IE11下CKEditor在Bootstrap Modal中下拉問(wèn)題的解決方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

最近在項(xiàng)目中需要在Bootstrap Modal彈出框中載入CKEditor。

初始化CKEditor以后,在IE11下,格式/字體/顏色的下拉會(huì)閃現(xiàn)一下后就消失,但在chrome和firefox下沒(méi)問(wèn)題。

主要原因是IE11下,點(diǎn)擊CKEditor,觸發(fā)了focusin.modal事件,原modal enforceFocus函數(shù)的if條件成立,bootstrap modal獲取焦點(diǎn),CKEditor下拉失去焦點(diǎn),所以下拉出現(xiàn)閃現(xiàn)。

Google了以后找到了一個(gè)解決方案

這個(gè)解決方案中,加了判斷后,可以避免modal獲取焦點(diǎn),但好像modal一直都不會(huì)trigger了。

我做了一下修改,以下代碼是在原modal enforceFocus函數(shù)的基礎(chǔ)上添加了!$(e.target.parentNode).closest(".cke").length判斷條件,也就是說(shuō)在原判斷條件+未點(diǎn)擊在CKEditor上,則modal獲取焦點(diǎn)。

代碼的執(zhí)行順序是jQuery、bootstrap再執(zhí)行此段代碼。

$.fn.modal.Constructor.prototype.enforceFocus = function() {
 $(document)
  .off('focusin.bs.modal')
  .on('focusin.bs.modal', $.proxy(function (e) {
  if (document !== e.target &&
   this.$element[0] !== e.target &&
   !this.$element.has(e.target).length &&
   !$(e.target.parentNode).closest(".cke").length) {
   
   this.$element.trigger('focus')
  }
  }, this))
};

在項(xiàng)目中測(cè)試了一下未發(fā)現(xiàn)問(wèn)題。 

附 bootstrap.js中enforceFocus函數(shù)代碼對(duì)比

Modal.prototype.enforceFocus = function () {
 $(document)
  .off('focusin.bs.modal') // guard against infinite focus loop
  .on('focusin.bs.modal', $.proxy(function (e) {
  if (document !== e.target &&
   this.$element[0] !== e.target &&
   !this.$element.has(e.target).length) {
   this.$element.trigger('focus')
  }
  }, this))
 }

this.$element表示modal對(duì)象。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

二连浩特市| 凤山市| 渭源县| 逊克县| 五指山市| 永嘉县| 沙湾县| 渝中区| 唐河县| 于田县| 张家界市| 东至县| 思茅市| 阜城县| 新干县| 黄陵县| 盐边县| 松桃| 铜鼓县| 天峻县| 山阴县| 高淳县| 武城县| 敖汉旗| 华池县| 钦州市| 宁明县| 西宁市| 滕州市| 泉州市| 乌审旗| 邢台市| 囊谦县| 乌兰浩特市| 蕲春县| 盱眙县| 庐江县| 张家港市| 吉林市| 莆田市| 庄浪县|