textarea-autosize icon indicating copy to clipboard operation
textarea-autosize copied to clipboard

Scrolling offset manipulation

Open kulbakin opened this issue 8 years ago • 0 comments

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:

  1. Find actual scrollable parent and set scroll position for it
  2. 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.

kulbakin avatar Mar 31 '16 00:03 kulbakin