百度編輯器(ueditor)@功能之獲取坐標
阿新 • • 發佈:2017-08-17
election set tor 設置 fse 隱藏 edit var 功能
//獲取百度編輯器的工具類 var domUtils = UE.dom.domUtils; //獲取編輯器的坐標 var $ueditor_offset = $("#ueditor_0").offset(); //創建一個臨時dom,用於獲取當前光標的坐標 var bk_start = ue.selection.getRange().createBookmark().start; //設置臨時dom不隱藏 bk_start.style.display = ‘‘;//計算出x坐標 var x = ($ueditor_offset.left + domUtils.getXY(bk_start).x) + "px"; //計算出y坐標 var y = ($ueditor_offset.top + +bk_start.offsetHeight + domUtils.getXY(bk_start).y) + "px"; //移除臨時dom $(bk_start).remove();
百度編輯器(ueditor)@功能之獲取坐標