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

為了賬號安全,請及時綁定郵箱和手機立即綁定

正在回答

1 回答

<!DOCTYPE html>
<html>
<head>
? ?<meta charset="UTF-8">
? ?<title>輪播圖</title>
? ?<style type="text/css">
* {
? ? ? ? ? ?margin: 0;
padding: 0;
text-decoration: none;
}

? ? ? ?body {
? ? ? ? ? ?padding: 20px;
}

? ? ? ?#container {
? ? ? ? ? ?position: relative;
width: 600px;
height: 400px;
border: 3px solid #333;
overflow: hidden;
}

? ? ? ?#list {
? ? ? ? ? ?position: absolute;
z-index: 1;
width: 4200px;
height: 400px;
}

? ? ? ?#list img {
? ? ? ? ? ?float: left;
width: 600px;
height: 400px;
}
? ? ? ?#buttons {
? ? ? ? ? ?position: absolute;
left: 250px;
bottom: 20px;
z-index: 2;
height: 10px;
width: 100px;
}

? ? ? ?#buttons span {
? ? ? ? ? ?float: left;
margin-right: 5px;
width: 10px;
height: 10px;
border: 1px solid #fff;
border-radius: 50%;
background: #333;
cursor: pointer;
}

? ? ? ?#buttons .on {
? ? ? ? ? ?background: orangered;
}

? ? ? ?.arrow {
? ? ? ? ? ?position: absolute;
top: 180px;
z-index: 2;
display: none;
width: 40px;
height: 40px;
font-size: 36px;
font-weight: bold;
line-height: 39px;
text-align: center;
color: #fff;
background-color: RGBA(0, 0, 0, .3);
cursor: pointer;
}

? ? ? ?.arrow:hover {
? ? ? ? ? ?background-color: RGBA(0, 0, 0, .7);
}

? ? ? ?#container:hover .arrow {
? ? ? ? ? ?display: block;
}

? ? ? ?#prev {
? ? ? ? ? ?left: 20px;
}

? ? ? ?#next {
? ? ? ? ? ?right: 20px;
}
? ?</style>
</head>
<body>
<!--父容器container存放所有內(nèi)容,
? ?子容器list存放圖片。
? ?子容器buttons存放按鈕小圓點
-->
<div id="container">
? ? ? <div id="list" style="left: -600px">
? ? ? ? ? <img src="img/05.jpg" alt="1">
? ? ? ? ? <img src="img/01.jpg" alt="1">
? ? ? ? ? <img src="img/02.jpg" alt="2">
? ? ? ? ? <img src="img/03.jpg" alt="3">
? ? ? ? ? <img src="img/04.jpg" alt="4">
? ? ? ? ? <img src="img/05.jpg" alt="5">
? ? ? ? ? <img src="img/01.jpg" alt="5">
? ? ? </div>
? ? ? <div id="buttons">
? ? ? ? ? <span index="1"></span>
? ? ? ? ? <span index="2"></span>
? ? ? ? ? <span index="3"></span>
? ? ? ? ? <span index="4"></span>
? ? ? ? ? <span index="5"></span>
? ? ? </div>
? ? ? <a href="javascript:;" id="prev">&lt;</a>
? ? ? <a href="javascript:;" id="next">&gt;</a>
? </div>
<script>
window.onload=function (){
? ? ? ?var ?container =document.getElementById('container');
var list=document.getElementById('list');
var buttons=document.getElementById('buttons').getElementsByTagName('span');//獲取5個按鈕
var prev=document.getElementById('prev');//上一個
var next=document.getElementById('next');//下一個
var index=1;
var timer;
/*點亮小圓點*/
function showButton(){

? ? ? ? ? ?for(var i=0;i<buttons.length;i++){
? ? ? ? ? ? ? ?if(buttons[i].className=='on'){
? ? ? ? ? ? ? ? ? ?buttons[i].className='';
break;
}
? ? ? ? ? ?}
? ? ? ? ? ?buttons[index-1].className='on';
}

? ? ? ?/*箭頭點擊事件**/
function animate(offset){//封裝按鈕左右點擊,傳參offset
var newLeft=parseInt(list.style.left)+offset;
var time=300;//位移總時間
var interval=10;//位移間隔
var speed=offset/(time/interval);//每次位移量


function go(){
? ? ? ? ? ? ? ?if((speed<0 && parseInt(list.style.left)>newLeft) || (speed >0&&parseInt(list.style.left)<newLeft)){
? ? ? ? ? ? ? ? ? ?list.style.left=parseInt(list.style.left)+speed+'px';

/*定時器*/
setTimeout(go,interval);
}
? ? ? ? ? ? ? ?else{

? ? ? ? ? ? ? ? ? ?list.style.left=newLeft+'px';
/* 判斷是否滾動到附屬圖上,滾動到附屬圖上歸位*/
if(newLeft> -600){
? ? ? ? ? ? ? ? ? ? ? ?list.style.left = -3000 + 'px';
}
? ? ? ? ? ? ? ? ? ?if(newLeft< -3000){
? ? ? ? ? ? ? ? ? ? ? ?list.style.left = -600 + 'px';
}
? ? ? ? ? ? ? ?}
? ? ? ? ? ?}

? ? ? ? ? ? ? ?go();

}

? ? ? ?function play(){

? ? ? ? ? ?timer=setInterval(function (){
? ? ? ? ? ? ? ?next.onclick();
},3000);
}
? ? ? ?function stop(){
? ? ? ? ? ?clearInterval(timer);
}
? ? ? ?next.onclick=function (){
? ? ? ? ? ?if(index==5){
? ? ? ? ? ? ? ?index=1;
}
? ? ? ? ? ?else{
? ? ? ? ? ? ? ?index +=1;
}

? ? ? ? ? ? ? ? ? ?showButton();
animate(-600);//點擊右箭頭-600
}
? ? ? ?prev.onclick=function (){
? ? ? ? ? ?if(index==1){
? ? ? ? ? ? ? ?index=5;
}
? ? ? ? ? ?else{
? ? ? ? ? ? ? ?index -= 1;
}

? ? ? ? ? ?showButton();
animate(-600);//點擊左箭頭600
}

? ? ? ?for(var i=0;i<buttons.length;i++){
? ? ? ? ? ?//原始值
buttons[i].onclick=function (){
? ? ? ? ? ? ? ?if(this.className=='on'){
? ? ? ? ? ? ? ? ? ?return;
}

? ? ? ? ? ? ? ?var myIndex=parseInt(this.getAttribute('index'));
var offset=-600 *(myIndex -index);
animate(offset);
index=myIndex;
showButton();
}
? ? ? ?}
? ?container.onmouseover=stop;
container.onmouseout=play;


}
</script>
</body>
</html>

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

舉報

0/150
提交
取消
焦點圖輪播特效
  • 參與學(xué)習(xí)       65327    人
  • 解答問題       634    個

通過本教程學(xué)習(xí)您將能掌握非常實用的焦點圖輪播特效的制作過程

進入課程
微信客服

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

幫助反饋 APP下載

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

公眾號

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