2012-05-10 52 views

回答

3

与大多数没有信号的语言一样,您不能执行插值,您必须连接多个字符串。

"foo" + "bar" + "baz" 
"foo" + string_var + "baz" 
"+=" + string_var + "px" 
0

可以使用+运算符来连接你的价值在一个变量的"+="字符串:

$('#contactForm').animate({"marginLeft": "+=" + size}, "slow"); 
0
var theWidth = "680px" 
$('#contactForm').animate({marginLeft: "+=" + theWidth}, "slow"); 
1
var size = "680px"; 
$('#contactForm').animate({"marginLeft": "+="+size}, "slow"); 
相关问题