Prevent the jQuery Elastic plugin from resizing the textarea down on click outside
anyone using the j开发者_如何学编程Query Elastic plugin around here?
Pretty handy but I just don't find a way to prevent the script from slightly resizing the height of the textarea down once you click out of it. Just make the test: make the area grow by typing something and click out of the textarea.
It's frustrating and gives a bad experience since I have a button at the bottom of my textarea which also moves then. Any idea?
Just initialize it using $('#container').elastic().trigger('blur')
This will run the commands that are run after a blur event, resizing the textbox.
add mouseout to the event binding:
$textarea.bind('blur mouseout',function(){
on line 140.
I faced the same problem, and after searching for a long time i came up with a solution. here is what you need to change in the Jquery Elastic JS file.
Find the following Line.
minheight = parseInt ............
and change it with this line.
minheight = parseInt($textarea.css('height'),5) || lineHeight*2,
This should solve the problem of clicking outside of the textarea and resizing the box.
精彩评论