Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


JQUERY Animate width using variable

JQUERY Animate width using variable

JQUERY Animate width using variable

Good evening,

Please can someone help me with this code? I'm just trying to animate the width of a progress bar based on a variable, the code works fine if I write this: $(this).animate({width:"100px"},350); so I think it is just a syntax problem but I can't for the life of me figure it out!

CODE -->

    var a= $( this ).css( "width" );

Thanks in advance

RE: JQUERY Animate width using variable

I think I made a silly mistake:

I set width 0 first and then animated:

CODE -->

$(this).css("width", "0"); 

now it works :)

RE: JQUERY Animate width using variable

good job. made it work after all.

but 'making it work' and understanding why what you did, made it work is the difference between a hacker and a programmer :)

im in between the two tbh heh


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close