Search code examples
jquerywysihtml5

Stop scrolling to top of textarea element, after create using wysihtml5


I'm dynamically adding more wysihtml5 editors to the page using javascript.

The problem that I'm having is when the editor gets added into the page the window scrolls to the top of the editor that was added.

  make_new_editor:function(textarea_id, toolbar_id){
    var editor = new wysihtml5.Editor(textarea_id, {
      toolbar:      toolbar_id,
      stylesheets:  "/assets/app/text.css",
      parserRules:  wysihtml5ParserRules
    });
  }

I simply want the editor to get added without affecting the scroll position and can't figure out how.

I'm using wysihtml5 v0.4.0pre


Solution

  • I realised that the url in my browser had a # at the end. After removing the hash it worked fine in chrome but it still jumped a bit in firefox.