Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
haxen2000

Having an issue with borderWidth

Recommended Posts

Might be doing something wrong here, but I'm curious if anyone else has had this issue. I am trying to animate the border of an input area from 0 to a width back to 0. Going from a width to 0 works fine, but going from 0 to the width immediately jumps to the width while everything else animates. I've made an exaggerated example here: http://jsfiddle.net/Haxen2000/Df8xj/ The original margin is what the border width should be; just made it larger so the issue is more visible.

 

Thanks!

Link to post
Share on other sites

Hello... and welcome to the GreenSock Forums!

If you check Mozilla Developer Network.. you will see how border-width is not an animated property

https://developer.mozilla.org/en-US/docs/Web/CSS/border-width

You have to use the non shorthand properties..

Animatable as each of the properties of the shorthand:
border-bottom-width: yes
border-left-width: yes
border-right-width: yes
border-top-width: yes

 

border-width: no

And if you dont use quotes.. make sure you use camelCase for the property name.. ie. borderTopWidth for example

Hope this helps..

  • Like 2
Link to post
Share on other sites

It's actually happening in Chrome for me. It's weird that it will animate to 0 but not from 0. However, that trick worked (at least for Chrome). Thanks a bunch!

Link to post
Share on other sites

glad you got it working .. it will work in Firefox also :)

Link to post
Share on other sites

If you just use a single value (like "10px"), it should be fine. I think the problem is that you're using a complex value (like "10px 12px 9px 10px"). Of course you could still animate that if you want, using a generic proxy object and an onUpdate where you apply it, but it's not as convenient. 

  • Like 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×