6

I'm trying to animate an element's width using velocity and the calc() function.

$("#menuContainer").velocity({width: "calc(100% + -260px)"}, 500);

this animates the element's width to 0.

Does .velocity not support the css function calc()? or am do i overlooking a basic syntax error?

dippas
  • 58,591
  • 15
  • 114
  • 126
esd
  • 105
  • 1
  • 9

1 Answers1

5

Why don't you use

$("#menuContainer").velocity({width: '-=260px'}, 500);  

For 50% width, you can use:

var menu=$("#menuContainer");      
menu.velocity({width:menu.width()/2}, 500);
The Process
  • 5,913
  • 3
  • 30
  • 41