簡體   English   中英

ckeditor scrollIntoView編輯器中的div元素

[英]ckeditor scrollIntoView to a div element within the editor

我在ckeditor旁邊有一個導航菜單,我想在編輯器中導航,因為我在編輯器中的所有元素都有ID

scrollIntoView

這是如何運作的

任何例子都會很好

這個問題中的信息(幾個月前我本人提出的)應該可以幫助您入門。 可接受的答案概述了如何從JQUery以編程方式訪問CKEditor文檔中的元素。

應該有可能獲取所需的元素,並根據該元素執行ScrollIntoView

可能已經起作用(未試用):

var documentWrapper = editorname.document; // replace by your CKEDitor instance ID
var documentNode = documentWrapper.$; // or documentWrapper['$'] ;
documentNode.getElementById("id").scrollIntoView(); // Insert your element ID there

問題是您實際上沒有將作用域放入CKEDITOR實例中。 為了獲得指向文檔的變量,請執行以下操作:

var ckeditorDocument = CKEDITOR.instances.[instancename].document.$;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM