Ckeditor滚动条标记/文本位置指示器
我想将scrollbar marker实现到ckeditor中,但我似乎找不到正确的方法,我已经遍历了这段代码Ckeditor滚动条标记/文本位置指示器,ckeditor,scrollbar,ckeditor4.x,Ckeditor,Scrollbar,Ckeditor4.x,我想将scrollbar marker实现到ckeditor中,但我似乎找不到正确的方法,我已经遍历了这段代码 var win = new CKEDITOR.dom.window( window ); var pos = win.getScrollPosition(); console.log(pos); 但它只返回google chrome滚动条x=0&Y=0 var win = new CKEDITOR.dom.window( domWindow ); var pos = win.getS
var win = new CKEDITOR.dom.window( window );
var pos = win.getScrollPosition();
console.log(pos);
但它只返回google chrome滚动条x=0&Y=0
var win = new CKEDITOR.dom.window( domWindow );
var pos = win.getScrollPosition();
console.log(pos);
这给了我一个错误,domWindow没有定义
我发现这个例子可能会有帮助:
但是由于ckeditor保护了很多元素,我很想知道以前是否有人使用ckeditor这样做过。我刚刚获得了真正的编辑器滚动条位置,我只需要使用样式或任何可用的方法放置一个标记
var win=CKEDITOR.instances.editor1.document.getWindow();
var pos = win.getScrollPosition().y;
console.log(pos);
这对我很有用:
var jqDocument = $(editor.document.$);
var documentHeight = jqDocument.height();
var scrollTo =jqDocument.scrollTop();
var docHeight = jqDocument.height();
var scrollPercent = (scroll)/(docHeight);
var scrollPercentRounded = Math.round(scrollPercent*100);
$(".ui-slider-handle").css("bottom", 100-scrollPercentRounded+"%");
var jqDocument = $(editor.document.$);
var documentHeight = jqDocument.height();
var scrollTo =jqDocument.scrollTop();
var docHeight = jqDocument.height();
var scrollPercent = (scroll)/(docHeight);
var scrollPercentRounded = Math.round(scrollPercent*100);
$(".ui-slider-handle").css("bottom", 100-scrollPercentRounded+"%");