Reputation: 4537
I am using https://github.com/ultimatedelman/autogrow so my textarea grows as the user enters text. It works great, but when you get the bottom of the text area, it scrolls up before expanding, causing an unsightly jumping effect. This is visible in the author's demo as well (click on "Interactive Demo" on the above page since Stack Overflow won't let me post a jsfiddle.net here unaccompanied by code).
Is there some way to suppress vertical scrolling completely to avoid this jumping effect? I tried:
textarea.scroll(function(e) {
e.preventDefault();
});
That doesn't seem to prevent the scrolling from occurring though.
Upvotes: 2
Views: 620
Reputation: 4537
Just discovered http://www.jacklmoore.com/autosize/. It is way slicker than the plugin I mentioned in the question. Notably it has no problem at all with jumping or gittering as it resizes. So this seem like the right answer.
Upvotes: 1