CSS function Velocity.js and calc ()

I am trying to animate the width of an element using the speed and calc () function.

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

this animates the width of the element to 0.

. speed doesn't support css calc () function? or I do not see the main syntax error?

+5
source share
1 answer

Why don't you use

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

For a width of 50% you can use:

 var menu=$("#menuContainer"); menu.velocity({width:menu.width()/2}, 500); 
+4
source

Source: https://habr.com/ru/post/1244693/


All Articles