分類
- 1app
- 2選項(xiàng)卡
- 3后臺(tái)
- 4彈窗
- 5下拉菜單
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<div class="c-banner"> <div class="banner"> <ul> <li><img src="img/lunbo1.jpg"></li> <li><img src="img/lunbo2.jpg"></li> <li><img src="img/lunbo3.jpg"></li> </ul> </div> <div class="nexImg"> <img src="img/nexImg.png" /> </div> <div class="preImg"> <img src="img/preImg.png" /> </div> <div class="jumpBtn"> <ul> <li jumpImg="0"></li> <li jumpImg="1"></li> <li jumpImg="2"></li> </ul> </div> </div> <script type="text/javascript"> //點(diǎn)擊停止輪播 $("#stop").click(function(){ clearInterval(time); console.log("dsda"); }) //用于判斷導(dǎo)航欄的狀態(tài) var toggle = true; var time=null; var nexImg = 0; var bannerHeight = $(".c-banner ul li img").eq(0).css("height"); var imgLength = $(".c-banner .banner ul li").length; $(".c-banner").css("height",bannerHeight); $(".c-banner .jumpBtn ul li[jumpImg="+nexImg+"]").css("background-color","black"); //導(dǎo)航欄最后一個(gè)li的邊框去除 $(".c-nav ul li:last").css("border","none"); //導(dǎo)航欄按鈕 $('.btnImg').click(function() { if (toggle) { $('.btnImg').css("border", "1px solid #b0ccf3"); toggle = false } else { $('.btnImg').css("border", "1px solid transparent"); toggle = true; } $(".show").slideToggle(300); }) //窗口大小發(fā)生改變 $(window).resize(function() { //獲取窗口寬度 var windSize = $(window).width(); if (windSize > 576) { $(".show").slideDown(0); } else { $(".show").slideUp(0); } var bannerHeight = $(".c-banner ul li[style*='block'] img").css("height"); $(".c-banner").css("height",bannerHeight); }); $(document).ready(function(){ //定時(shí)器 time =setInterval(intervalImg,3000); }); //點(diǎn)擊上一張 $(".preImg").click(function(){ clearInterval(time); nexImg = nexImg-1; if(nexImg<0){ nexImg=imgLength-1; } $(".c-banner .jumpBtn ul li").css("background-color","white"); $(".c-banner .jumpBtn ul li[jumpImg="+nexImg+"]").css("background-color","black"); $(".c-banner .banner ul li").eq(nexImg).css("display","block"); $(".c-banner .banner ul li").eq(nexImg).stop().animate({"opacity":1},1000); $(".c-banner .banner ul li").eq(nexImg+1).stop().animate({"opacity":0},1000,function(){ $(".c-banner ul li").eq(nexImg+1).css("display","none"); }); time =setInterval(intervalImg,3000); }) //點(diǎn)擊下一張 $(".nexImg").click(function(){ clearInterval(time); intervalImg(); time =setInterval(intervalImg,3000); }) //輪播圖 function intervalImg(){ if(nexImg<imgLength-1){ nexImg++; }else{ nexImg=0; } $(".c-banner .banner ul li").eq(nexImg).css("display","block"); $(".c-banner .banner ul li").eq(nexImg).stop().animate({"opacity":1},1000); $(".c-banner .banner ul li").eq(nexImg-1).stop().animate({"opacity":0},1000,function(){ $(".c-banner .banner ul li").eq(nexImg-1).css("display","none"); }); $(".c-banner .jumpBtn ul li").css("background-color","white"); $(".c-banner .jumpBtn ul li[jumpImg="+nexImg+"]").css("background-color","black"); } //輪播圖底下按鈕 $(".c-banner .jumpBtn ul li").each(function(){ $(this).click(function(){ clearInterval(time); $(".c-banner .jumpBtn ul li").css("background-color","white"); jumpImg = $(this).attr("jumpImg"); if(jumpImg!=nexImg){ var after =$(".c-banner .banner ul li").eq(jumpImg); var befor =$(".c-banner .banner ul li").eq(nexImg); nexImg=jumpImg; after.css("display","block"); after.stop().animate({"opacity":1},1000); befor.stop().animate({"opacity":0},1000,function(){ befor.css("display","none"); }); } $(this).css("background-color","black"); time =setInterval(intervalImg,3000); }); }); </script>
1. 本站所有素材(未指定商用),僅限學(xué)習(xí)交流。
2. 會(huì)員在本站下載的原創(chuàng)商用和VIP素材后,只擁有使用權(quán),著作權(quán)歸原作者及17素材網(wǎng)所有。
3. 原創(chuàng)商用和VIP素材,未經(jīng)合法授權(quán),請(qǐng)勿用于商業(yè)用途,會(huì)員不得以任何形式發(fā)布、傳播、復(fù)制、轉(zhuǎn)售該素材,否則一律封號(hào)處理。
4. 本平臺(tái)織夢(mèng)模板僅展示和個(gè)人非盈利用途,織夢(mèng)系統(tǒng)商業(yè)用途請(qǐng)預(yù)先授權(quán)。