Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用速度和 calc() 函数为元素的宽度设置动画。
$("#menuContainer").velocity({width: "calc(100% + -260px)"}, 500);
这会将元素的宽度设置为 0。
.velocity不支持 css 函数calc()吗?还是我忽略了一个基本的语法错误?
你为什么不使用
$("#menuContainer").velocity({width: '-=260px'}, 500);
对于50%的宽度,您可以使用:
var menu=$("#menuContainer"); menu.velocity({width:menu.width()/2}, 500);