[英]Velocity.js and calc() CSS function
I'm trying to animate an element's width using velocity and the calc() function. 我正在尝试使用velocity和calc()函数为元素的宽度设置动画。
$("#menuContainer").velocity({width: "calc(100% + -260px)"}, 500);
this animates the element's width to 0. 这会将元素的宽度设置为0。
Does .velocity not support the css function calc() ? .velocity不支持css函数calc()吗? or am do i overlooking a basic syntax error?
或者我是否忽略了基本的语法错误?
Why don't you use 你为什么不用
$("#menuContainer").velocity({width: '-=260px'}, 500);
For 50% width, you can use: 对于50%宽度,您可以使用:
var menu=$("#menuContainer");
menu.velocity({width:menu.width()/2}, 500);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.