Saturday, July 2, 2016

Summernote.JS Modal ScrollTop Problem - FIXED

Summernote Modal scrollTop issue.

If you are on mobile, it's unavoidable if you notice that summernote.js causes your modal window to scroll to top when you click on insert image or insert link button. This is due to the keyboard being open and moble browser unable to detect the proper position.

A simple solution will be as follows.

$('[data-original-title="Picture"]').on('click',function(e) { //Detect Insert Image Button
    $('.note-image-url').blur(); //Unfocus the field in the image dialog. 
});
 
 
The above will force the dialog to open immediately.