我的网站上有以下内容...
// Move to 'start' element
.moveTo(400, 50, {name: "one"})
// Line to 'description' element
.lineTo(1600, 50, {name: "two"})
// Arc down and line to 'syntax'
.lineTo(3200, 50, {name: "three"})
// Continue line to 'scrollbar'
.lineTo(3200, 50, {name: "four"})
我希望每个函数中的第一个值成为一个变量,然后相应地倍增。我试过以下没有运气,但我想知道这是否可能?
var width = $(window).width();
// Move to 'start' element
.moveTo(width, 50, {name: "one"})
// Line to 'description' element
.lineTo(width * 2, 50, {name: "two"})
// Arc down and line to 'syntax'
.lineTo(width * 3, 50, {name: "three"})
// Continue line to 'scrollbar'
.lineTo(width * 4, 50, {name: "four"})