第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

javascript怎么讓切換到了最后就停止啊?

javascript怎么讓切換到了最后就停止啊?

MMTTMM 2018-12-07 07:05:57
現(xiàn)在是點(diǎn)擊右邊按鈕無(wú)限制的切換了.我想讓它切換到了最后就停止切換了.要怎么來(lái)判斷啊?關(guān)鍵是這里if(cur == li-1){? return false;}自己插入jquery文件. <!doctype html><html> <head> <style type="text/css"> *{padding:0;margin:0;} .fl{float:left;display:inline;} .fr{float:right;display:inline;} .gallery_pic_small{width:757px;height:50px;position:relative;overflow:hidden;margin-top:8px;margin-left:9px} .gallery_pic_small_w{width:836px;height:62px; background:url(../images/gallery_nav_bg.jpg) no-repeat;margin:0 auto 46px} .gallery_small_left{margin-top:22px;margin-left:15px;width:16px;height:16px;overflow:hidden;background:orange;} .gallery_small_right{background:orange;margin-top:22px;margin-left:10px;width:16px;height:16px;overflow:hidden} .gallery_pic_small_in{position:absolute;top:0;left:0;} .gallery_pic_small_in li{float:left;width:;margin-right:13px;width:115px;display:inline} .gallery_pic_small_in li img{border:1px solid #ccc} </style> <script type="text/javascript" src="jquery-1.6.min.js"> </script> </head> <body><div class="gallery_pic_small_w" id="gallery_pic_small_w"> <div class="gallery_small_left fl" id="gallery_small_left"> <img src="images/003_16.jpg" width="16" height="16"> </div> <div class="gallery_pic_small fl"> <div class="gallery_pic_small_in" id="gallery_pic_small_in"> <ul> <li><img src="images/003_03.jpg" width="113" height="44"></li> <li><img src="images/003_05.jpg" width="113" height="44"></li> <li><img src="images/003_07.jpg" width="113" height="44"></li> <li><img src="images/003_09.jpg" width="113" height="44"></li> <li><img src="images/003_11.jpg" width="113" height="44"></li> <li><img src="images/003_13.jpg" width="113" height="44"></li> <li><img src="images/003_17.jpg" width="113" height="44"></li> </ul> </div> </div> <div class="gallery_small_right fl" id="gallery_small_right"> <img src="images/003_19.jpg" width="16" height="16"> </div> </div> <script type="text/javascript"> function gallery_change(o,e,l,r,m){ var li = $(o).find("li").length; var li_w = m?$(o).find("li").width()+17:$(o).find("li").width(); $(o).find(e).css("width",li*li_w+"px") var cur =0; function move(n){ switch(n){ case0: if(cur ==0){ returnfalse; } cur--; if(m ==true) { $(o).find(e).stop(true,true).animate({left:-(768*cur)},400) } else{ $(o).find(e).stop(true,true).animate({left:-(1000*cur)},400) } break; case1: if(cur == li-1){ returnfalse; } cur++; if(m ==true){ $(o).find(e).stop(true,true).animate({left:-(768*cur)},400) } else{ $(o).find(e).stop(true,true).animate({left:-(1000*cur)},400) } break; } } $(o).find(l).click(function(){ move(0) }) $(o).find(r).click(function(){ move(1) }) } gallery_change("#gallery_pic_small_w","#gallery_pic_small_in","#gallery_small_left","#gallery_small_right",true) </script> </body> </html>
查看完整描述

1 回答

?
楊魅力

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超6個(gè)贊

1. 看這代碼很糾結(jié)...完全沒(méi)搞明白 m的作用是什么,true了 給 li加的寬度 ,否則 不走了;

2. 768 和 1000 怎么來(lái)的我也沒(méi)看明白,算我笨吧.

3.

if(cur == li-1){
return false;
}

貌似是要根據(jù)滾動(dòng)過(guò)去的li的數(shù)量來(lái)控制,從這里看你似乎是按一次滾動(dòng)一個(gè)li內(nèi)容,但是實(shí)際上

?

// <div class="gallery_pic_small_in" id="gallery_pic_small_in">
if
(m ==true)
{
$(o).find(e).stop(true,true).animate({left:-(768*cur)},400)
}
else{
$(o).find(e).stop(true,true).animate({left:-(1000*cur)},400)
}

?

你滾動(dòng)的是固定位置.

(113 + 17) * 7 = 910;113 * 7 = 791;

4. 很抱歉,沒(méi)理解你的思路,不過(guò)我覺(jué)得根據(jù)你的思路,用left控制;

查看完整回答
反對(duì) 回復(fù) 2018-12-24
  • 1 回答
  • 0 關(guān)注
  • 459 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)