能否在Swipe中直接傳入參數
為什么不在調用Swipe的時候直接傳入參數呢?我試了下也可以啊 ?請問這樣做有什么不好?
swipe.scrollTo = function(x, speed) {
? ? ? ? //執行動畫移動
? ? ? ? element.css({
? ? ? ? ? ? 'transition-timing-function' : 'linear',
? ? ? ? ? ? 'transition-duration' ? ? ? ?: speed + 'ms',
? ? ? ? ? ? 'transform' ? ? ? ? ? ? ? ? ?: 'translate3d(-' + x + 'px,0px,0px)'
? ? ? ? });
? ? ? ? return this;
? ? };
? ? return swipe;
}
這里return this和return swipe不太明白 ?
2016-08-20
return this:是返回根目錄
return swipe:是返回swipe