Josh R
Josh R

Reputation: 1295

How to animate the transition in jQuery

I am using jQuery to expand increase the rows of the textarea from 1 to 4 on focus. Lets just say it is not very pleasing to the eye.

I want it to slowly ease from 1 rows to 4 rows.

I currently use:

  $(document).ready(function(){
     $('.comment').focus(function(){
         $(this).attr('rows', '4');
     });
  });

How can I animate it to make it slide down slower?

I appreciate any help.

Upvotes: 0

Views: 409

Answers (2)

sampac
sampac

Reputation: 107

Have you seen this ? I think it does exactly what you need... http://james.padolsey.com/javascript/jquery-plugin-autoresize/

Sam

Upvotes: 0

please delete me
please delete me

Reputation:

http://api.jquery.com/animate/

Gives some info on custom property animations. also making animation on css height attribute might make it look more pleasant to the eye.

Upvotes: 0

Related Questions