Marcus25
Marcus25

Reputation: 883

Getting DIV with specific ID to the top of TinyMCE editor

I am using TinyMCE as HTML editor with Asp.net and MVC3. I have Html something like this

<html>
<div id  = "A1" ........../>
<div id  = "A1" ........../>
<div id  = "A1" ........../>
</html>

Also, I have 3 different buttons, clicking on which, the appropriate in html should scroll and come to the top of Editor.

e.g If I click on button "A1", the DIV with id "A1" should come to the top and likewise.

I saw some timy mce API called "getBookmark", but I dont know how to use it. Or is there any other approach which will help me achieve the above purpose.

Upvotes: 2

Views: 716

Answers (1)

Thariama
Thariama

Reputation: 50832

To scroll to a specified element you may use

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

Upvotes: 1

Related Questions