老師提供的源代碼里,這一段是什么意思?視頻里面好像沒有講?
var?go?=?function?(){ ????????????????????if?(?(speed?>?0?&&?parseInt(list.style.left)?<?left)?||?(speed?<?0?&&?parseInt(list.style.left)?>?left))?{ ????????????????????????list.style.left?=?parseInt(list.style.left)?+?speed?+?'px'; ????????????????????????setTimeout(go,?inteval); ????????????????????} ????????????????????else?{ ????????????????????????list.style.left?=?left?+?'px'; ????????????????????????if(left>-200){ ????????????????????????????list.style.left?=?-600?*?len?+?'px'; ????????????????????????} ????????????????????????if(left<(-600?*?len))?{ ????????????????????????????list.style.left?=?'-600px'; ????????????????????????} ????????????????????????animated?=?false; ????????????????????} ????????????????}
中的
if(left>-200){
? ? ? ? ? ? ? ? ? ? ? ? ? ?list.style.left = -600 * len + 'px';
? ? ? ? ? ? ? ? ? ? ? ?}
if(left<(-600 * len)) {
? ? ? ? ? ? ? ? ? ? ? ? ? ?list.style.left = '-600px';
? ? ? ? ? ? ? ? ? ? ? ?}
2016-10-04
就是最初通過animate實現圖片左右輪播時的實現方法,根據改變left的值,實現圖片運動。len = 5.就是移動的次數。也就是圖片的數量。
/*3.1*/
list.style.left = newLeft + 'px';
if(newLeft > -600){
list.style.left = -3000 + 'px';
}
if(newLeft < -3000){
list.style.left = -600 + 'px';
}
和這個一個意思。在這里-3000 = -600*len.
2016-10-11
嗨 ?-200 哪里來的 這個你找到答案了嗎 ?我也不清楚
2016-10-07
-200哪里來的?