2013-06-13 51 views
2

我正在使用TinyMCE編輯器插件與ASP.NET和MVC3。滾動到TinyMCE編輯器中的特定內容

我想在html中滾動到特定的DIV內容。我怎樣才能做到這一點。

var ed = tinymce.editors[0]; 
     var $marker = $(ed.getBody()).find('#Content_500'); 
     tinymce.activeEditor.selection.select($marker.get(0)).focus(); 

由此,選擇特定內容,但是光標不滾動到內容。

任何想法..

回答

6

這是可能的。

要在TinyMCE的編輯滾動或iframe可以使用以下

$(tinymce.activeEditor.getBody()).animate({ scrollTop: 300 }, { duration: 'medium', easing: 'swing' }); 

要滾動到指定的元素則可以使用

$(tinymce.activeEditor.getBody()).find('#content_500').get(0).scrollIntoView();