Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Velocity.js and calc() CSS function

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?

like image 906
esd Avatar asked Mar 08 '16 23:03

esd


1 Answers

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);
like image 183
The Process Avatar answered Nov 12 '22 04:11

The Process