解決Ueditor在bootstarp 模態框中全屏問題
阿新 • • 發佈:2017-07-05
i++ tag node target put dal ted star ==
基本的一些配置就不說了。先說一下要註意的問題:首先是zIndex的設置。記住最好都顯示設置模態框和ueditor的zIndex。理清他們的層疊關系。
特別是用到ueditor裏面的圖片上傳功能的更要設好zIndex的值。具體要怎麽設就不說了,有問題再討論。
然後是模態框裏的全屏問題:通常請款下模態框都比較小,讓用戶在模態框裏的編輯器寫東西,用戶體驗肯定不好。所以要將ueditor全屏。要使ueditor能在bootstrap模態框裏正常全屏顯示需要修改ueditor.all.js裏面的setFullScreen函數
在 while (Container.tagName != "BODY") { }裏面加上以下這段代碼://解決在modal上ueditor不能全屏的問題
var position = baidu.editor.dom.domUtils.getComputedStyle(container, "position"); nodeStack.push(position); var isModal = false; //判斷該dom是否為modal var classes = $(container).attr(‘class‘); if (classes !== undefined) { classes = classes.split(‘ ‘); for (var i = 0; i < classes.length; i++) { if (classes[i] == "modal") { isModal = true; } } } //如果是modal,則不設置position為static if (!isModal) { container.style.position = "static"; } container = container.parentNode;
其實就是判斷ueditor的父container是不是bootstrap模態框。如果是,則不將container.style.position設為static。否則全屏的ueditor會被其他元素覆蓋掉
解決Ueditor在bootstarp 模態框中全屏問題