<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>index</title> <style> *{margin:0px;padding:0px;} li{ list-style: none; } #slide{ width:100%; height:420px; overflow:hidden; position:relative; } #slide .slide-box{ width:100%; height:420px; position:relative; } #slide .slide-box li{ background-position:50% 0px; background-repeat:no-repeat; width:100%; height:420px; overflow:hidden; position:absolute; left:0px; top:0px; opacity:0; filter:alpha(opacity=0); } #slide .slide-box li div{ width:755px; height:420px; position:relative; margin:0px auto; } #slide .slide-box li b{ width:760px; height:210px; display:block; position:absolute; left:0px; top:-40px; background-position:20px 0px; background-repeat:no-repeat; z-index:1; opacity:0; filter:alpha(opacity=0); } #slide .slide-box li a{ width:755px; height:420px; background:url(./p_w_picpaths/spaceball.gif); display:block; position:absolute; left:0px; top:0px; z-index:2; } #slide .slide-nav{ width:100%; height:30px; position:absolute; bottom:0px; left:0px; z-index:3; } #slide .slide-nav .slide-nav-box{ width:755px; height:30px; line-height:30px; margin:0px auto; } #slide .slide-nav .slide-nav-box a{ display:inline-block; width:14px; height:14px; border-radius:50%; background:#b5b5b5; margin:0px 3px; } #slide .slide-nav .slide-nav-box a.active{ background:#c80002; } </style> <script src="jquery.js" type="text/javascript"> </script> <script type="text/javascript"> $(function(){ //得到這群圖片li var oLis = $('#slide .slide-box li'); //得到小圓圈的對(duì)象組 var oPage = $('#slide .slide-nav a'); var lens = oLis.size(); //定義一個(gè)定時(shí)器 var oTimer = null; //遍歷 oPage.each(function(index){ $(this).mouseover(function(){ //將索引傳入函數(shù) slideRun(index); }) }); //動(dòng)起來的函數(shù) function slideRun(index){ iNow = index; //1--小圓圈--先給自己加上,去除兄弟的樣式 oPage.eq(index).addClass('active').siblings().removeClass('active'); //2--圖片--opacity:0 //開始一個(gè)動(dòng)畫之前 停止所有之前的動(dòng)畫 oLis.eq(index).siblings().stop().animate({ opacity:0 },600).find('b').stop().animate({ //3--小文字 向上 并消失 top: -40, opacity:0 },600); oLis.eq(index).stop().animate({ opacity:1 },600).find('b').stop().animate({ //小文字 向下并顯示 opacity : 1, top : -10 },600); } //當(dāng)前顯示第幾張 var iNow = 0; autoRun(); function autoRun(){ oTimer = setInterval(function(){ if(iNow > lens-1){ //邊界控制 iNow = 0; } slideRun(iNow); iNow++; },5000); } // oLis.hover(function(){ //鼠標(biāo)放上去--->圖片停止 //清除定時(shí)器 clearInterval(oTimer); },function(){ //鼠標(biāo)移開----->圖片開始自動(dòng)切換 autoRun(); }) }) </script> </head> <body> <div id="slide"> <ul class='slide-box'> <li > <div> <b > </b> <a href="javascript:void(0);"> </a> </div> </li> <li > <div> <b > </b> <a href="javascript:void(0);"> </a> </div> </li> <li > <div> <b > </b> <a href="javascript:void(0);"> </a> </div> </li> <li > <div> <b > </b> <a href="javascript:void(0);"> </a> </div> </li> <li > <div> <b > </b> <a href="javascript:void(0);"> </a> </div> </li> </ul> <div class='slide-nav'> <div class='slide-nav-box'> <a class='active' href="javascript:void(0);"> </a> <a href="javascript:void(1);"> </a> <a href="javascript:void(2);"> </a> <a href="javascript:void(3);"> </a> <a href="javascript:void(4);"> </a> </div> </div> </div> </body> </html>
分享題目:jquery幻燈片
分享鏈接:http://sd-ha.com/article2/gcjeoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、全網(wǎng)營(yíng)銷推廣、響應(yīng)式網(wǎng)站、ChatGPT、做網(wǎng)站、企業(yè)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
營(yíng)銷型網(wǎng)站建設(shè)知識(shí)