jquery - Animate textarea height makes text shake? -
I animated a text field to increase the height and rows on a button click. However during the animation the text moves the text of the field up and down and once the animation is over, it is taken slightly up once, how can I stop it?
This is my code:
thanks :)
function morespace () {var thetxt = document.getElementById (. 'And more') value; Var box = document.forms ["myForm"] ["comment"]; If (box. Rows == 3) {$ ("#memail"). Fadeaut (200); $ ('# Comment'). Chetan ({'height': '+ = 235'}, 400, "swing"); Box.rows = 17; Document.getElementById ('more'). InnerHTML = "less space?"; } And {$ ('# comment'). Chetan ({'height': '- = 235'}, 400, "swing"); $ ("# Emailme") fadein (800). Box.rows = 3; Document.getElementById ('more'). InnerHTML = "more space?"; }} & lt; A href = "javascript: morespace ();" Id = "more" & gt; More space? & Lt; / A & gt; Update: You can ask jsfild for jsfild ^ _ ^
The problem is that decimal heights have caused the flicker. I changed it to use a linear development, at the same time, it is equal to the amount of pixels, or many of it (that is because the height is always an integer).
function morespace () {Var thetxt = document.getElementById ('more'). Values; Var box = document.forms ["myForm"] ["comment"]; If (box. Rows == 3) {$ ("#memail"). Fadeaut (200); $ ('# Comment'). Chetan ({'height': '+ = 235'}, 235, "linear"); Box.rows = 17; Document.getElementById ('more'). InnerHTML = "less space?"; } And {$ ('# comment'). Chetan ({'height': '- = 235'}, 470, "linear"); $ ("# Emailme") fadein (800). Box.rows = 3; Document.getElementById ('more'). InnerHTML = "more space?"; } }a???? We are never able to specify the height of jQuery "x.12343654234"
Hope this is acceptable for your needs.
Object:
Comments
Post a Comment