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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么加了if(){return}后,點(diǎn)按鈕還是會(huì)出現(xiàn)圖片混亂的問(wèn)題

<!DOCTYPE html>

<html>

<head>

<title>焦點(diǎn)輪播圖</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">

? ? ? ? ? *{ margin: 0; padding: 0; text-decoration: none;}

? ? ? ? ? body{padding: 50px}

? ? ? ? ? #container{

? ? ? ? ? width: 600px;

? ? ? ? ? height: 400px;

? ? ? ? ? border: 1px solid black;

? ? ? ? ? overflow: hidden;/*將超出容器部分(超出圖片)隱藏*/

? ? ? ? ? position:relative;/*相對(duì)定位*/

? ? ? ? ? }

? ? ? ? ? #buttons{

? ? ? ? ? position: absolute;/*絕對(duì)定位*/

? ? ? ? ? height: 10px;

? ? ? ? ? width: 100px;

? ? ? ? ? z-index: 2;/*設(shè)置元素的堆疊順序*/

? ? ? ? ? bottom: 20px;

? ? ? ? ? left: 250px;

? ? ? ? ? }

? ? ? ? ? #buttons span{

? ? ? ? ? ?border-radius: 50%;

? ? ? ? ? ?width: 10px;

? ? ? ? ? ?height: 10px;?

? ? ? ? ? ?border: 1px solid #a1a1a1;

? ? ? ? ? ?background-color: #dddddd;

? ? ? ? ? ?cursor:pointer;/*設(shè)置鼠標(biāo)移動(dòng)到該元素上時(shí)變化為手指指示*/

? ? ? ? ? ?float: left;

? ? ? ? ? ?margin-right: 5px;

? ? ? ? ? }

? ? ? ? ? #buttons .on{

? ? ? ? ? ? background: orangered;

? ? ? ? ? }

? ? ? ? ? .arrow{

? ? ? ? ? ?background-color:rgba(0,0,1,.3);

? ? ? ? ? ?width: 40px;

? ? ? ? ? ?height: 40px;

? ? ? ? ? ?z-index: 2;

? ? ? ? ? ?position: absolute;

? ? ? ? ? ?text-align: center;

? ? ? ? ? ?font-weight: bold;

? ? ? ? ? ?font-size: 36px;

? ? ? ? ? ?cursor:pointer;

? ? ? ? ? ?top:180px;

? ? ? ? ? ?display: none;

? ? ? ? ? ?line-height: 39px;

? ? ? ? ? ?color: white;

? ? ? ? ? }

? ? ? ? ? .arrow:hover{

? ? ? ? ? background-color: rgba(0,0,0,.7);

? ? ? ? ? }

? ? ? ? ? #container:hover .arrow {?

? ? ? ? ? display: block;

? ? ? ? ? }

? ? ? ? ? #prev{

? ? ? ? ? left: 20px;

? ? ? ? ? }

? ? ? ? ? #next{

? ? ? ? ? right: 20px;

? ? ? ? ? }

? ? ? ? ? #list{

? ? ? ? ? width:4200px;?

? ? ? ? ? height:400px;

? ? ? ? ? position: absolute;

? ? ? ? ? z-index: 1;

? ? ? ? ? }

? ? ? ? ? #list img{

? ? ? ? ? float: left;

? ? ? ? ? } ? ? ? ? ?

</style>

<script type="text/javascript">

window.onload=function(){

? ? ? ? ? ?var list = document.getElementById('list'); ? ? ? ? ? ?

? ? ? ? ? ? var prev = document.getElementById('prev');

? ? ? ? ? ? var next = document.getElementById('next');

? ? ? ? ? ? var buttons=document.getElementById('buttons').getElementsByTagName('span');

? ? ? ? ? ? var index=1;

? ? ? ? ? function turO(){

? ? ? ? ? ? ?for (var i=0;i<buttons.length;i++) {

? ? ? ? ? ? ? if (buttons[i].className=="on") {

? ? ? ? ? ? ? buttons[i].className="";

? ? ? ? ? ? ? break;

? ? ? ? ? ? ?}

? ? ? ? ? ? ?}

? ? ? ? ? ? ?buttons[index-1].className="on"; ? ? ? ? ??

? ? ? ? ? }


? ? ? ? ? function Smove(a){

? ? ? ? ? list.style.left=list.offsetLeft+a+"px";

? ? ? ? ? var newL=list.offsetLeft+a;

? ? ? ? ? if (newL>600) {

? ? ? ? ? list.style.left=-2400+'px';

? ? ? ? ? }

? ? ? ? ? else if(newL<-3600){

? ? ? ? ? list.style.left=-600+'px';

? ? ? ? ? }

? ? ? ? ? }

? ? ? ? ? prev.onclick=function(){

? ? ? ? ? if (index==1) {

? ? ? ? ? ? ? index=5;

? ? ? ? ? }

? ? ? ? ? else{index-=1;

? ? ? ? ? }

? ? ? ? ? turO();

? ? ? ? ? Smove(600);

? ? ? ? ? }

? ? ? ? ? next.onclick=function(){

? ? ? ? ? if (index==5) {

? ? ? ? ? ? ? index=1;

? ? ? ? ? }

? ? ? ? ? else{index+=1;

? ? ? ? ? }

? ? ? ? ? turO();

? ? ? ? ? Smove(-600);

? ? ? ? ? }

? ? ? ? ? for (var i = 0;i<buttons.length;i++) {

? ? ? ? ? buttons[i].onclick=function(){

? ? ? ? ? if(this.className == 'on') {

? ? ? ? ? ? ? ? ? ? ? ? return;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? var newindex=parseInt(this.getAttribute('index'));

? ? ? ? ? var mo=-600*(newindex-index);

? ? ? ? ? Smove(mo);

? ? ? ? ? index=newindex;

? ? ? ? ? turO();

? ? ? ? ? }

? ? ? ? ?}

}

</script>

</head>

<body>

<div id="container">

<div id="list" style="left: -600px;">

<img src="img/5.jpg" alt="1">

<img src="img/1.jpg" alt="1">

<img src="img/2.jpg" alt="2">

<img src="img/3.jpg" alt="3">

<img src="img/4.jpg" alt="4">

<img src="img/5.jpg" alt="5">

<img src="img/1.jpg" alt="5">

</div>

<div id="buttons">

<span index="1" class="on"></span>

<span index="2"></span>

<span index="3"></span>

<span index="4"></span>

<span index="5"></span>

</div>

? ? <div>

? ? <a href="javascript:;" id="prev" class="arrow">&lt;</a>

? ? <a href="javascript:;" id="next" class="arrow">&gt;</a>

? ? </div>

</div>

</body>

</html>


正在回答

3 回答

這里改一下就好了

function Smove(a){

? ? ? ? ?var newL=list.offsetLeft+a;

? ? ? ? ?list.style.left=newL+'px'

? ? ? ? ?if (newL<-3000) {

? ? ? ? ? list.style.left=-600+'px';

? ? ? ? ?}

? ? ? ? ?else if(newL>-600){

? ? ? ? ? list.style.left=-3000+'px';

? ? ? ? ?}

? ? ? ? ? }


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

GeT_WrOnG 提問(wèn)者

厲害了,我的哥!非常感謝!
2016-12-10 回復(fù) 有任何疑惑可以回復(fù)我~

哦,錯(cuò)了!


0 回復(fù) 有任何疑惑可以回復(fù)我~

你圖片順序排錯(cuò)了,應(yīng)該是這樣

<img src="img/5.jpg" alt="" title="">

<img src="img/1.jpg" alt="" title="">

<img src="img/2.jpg" alt="" title="">

<img src="img/3.jpg" alt="" title="">

<img src="img/4.jpg" alt="" title="">

<img src="img/5.jpg" alt="" title="">

<img src="img/1.jpg" alt="" title="">



0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么加了if(){return}后,點(diǎn)按鈕還是會(huì)出現(xiàn)圖片混亂的問(wèn)題

我要回答 關(guān)注問(wèn)題
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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