如何重写以下内容以使用变量:
element.style.webkitTransition = "opacity 1.0s ease";
我尝试了这些,但没有一个有效:
var kDuration = 1.0;
element.style.webkitTransition = "opacity kDurations ease";
var kDuration = 1.0;
element.style.webkitTransition = "opacity kDuration ease";
var kDuration = 1.0;
element.style.webkitTransition = "opacity kDuration s ease";
var kDuration = 1.0;
element.style.webkitTransition = "opacity kDuration + s ease";
var kDuration = 1.0s;
element.style.webkitTransition = "opacity kDuration ease";
答案 0 :(得分:0)
var kDurationfirst = "1.0s"; var kDuration= "opacity "+kDurationfirst +" ease";
element.style.webkitTransition = kDuration ;