textarea-autosize
textarea-autosize copied to clipboard
Scrolling offset manipulation
Current implementation works with container scrolling
var $window = $(window);
var currentScrollPosition = $window.scrollTop();
// ....
$window.scrollTop(currentScrollPosition);
The potential issue is that scrollable container for target textarea might not be the window, it can be any tag with overflow:scroll
It would be great to have the plugin to work properly for such case as well. The solutions I see:
- Find actual scrollable parent and set scroll position for it
- Use margin on textarea instead of manipulating scroll position, i.e. before reducing size of textarea to 0, one would set bottom margin of corresponding size, then extend size to newly calculated one, then reset margin back to original value.
Personally I think second option would be more appropriate.