国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

利用JS做網頁特效_大圖輪播(實例講解)

來源:懂視網 責編:小采 時間:2020-11-27 22:33:05
文檔

利用JS做網頁特效_大圖輪播(實例講解)

利用JS做網頁特效_大圖輪播(實例講解):廢話不多說,直接上代碼: <style> * { margin: 0px; padding: 0px; } .stage { width: 500px; height: 300px; border: 5px solid black; margin: 200px; position: relative; overflow: hidde
推薦度:
導讀利用JS做網頁特效_大圖輪播(實例講解):廢話不多說,直接上代碼: <style> * { margin: 0px; padding: 0px; } .stage { width: 500px; height: 300px; border: 5px solid black; margin: 200px; position: relative; overflow: hidde

廢話不多說,直接上代碼:

<style>
 * {
 margin: 0px;
 padding: 0px;
 }
 
 .stage {
 width: 500px;
 height: 300px;
 border: 5px solid black;
 margin: 200px;
 position: relative;
 overflow: hidden;
 }
 
 .to-left,
 .to-right {
 position: absolute;
 top: 0px;
 width: 50px;
 height: 300px;
 background-color: black;
 color: white;
 font-size: 30px;
 text-align: center;
 line-height: 300px;
 opacity: 0.3;
 }
 
 .to-left {
 left: 0px;
 }
 
 .to-right {
 right: 0px;
 }
 
 .to-left:hover,
 .to-right:hover {
 cursor: pointer;
 opacity: 0.5;
 }
 
 .banner {
 width: 3000px;
 height: 300px;
 }
 
 .items {
 float: left;
 width: 500px;
 height: 300px;
 background-color: blanchedalmond;
 font-size: 100px;
 text-align: center;
 line-height: 300px;
 }
 </style>
 </head>
<!--大圖輪播特效-->
 <body>
 <div class="stage">
 <div class="to-left">
 <</div>
 <div class="to-right">></div>
 <div class="banner">
 <div class="items">1</div>
 <div class="items" style="">2</div>
 <div class="items" style="">3</div>
 <div class="items" style="">4</div>
 <div class="items" style="">5</div>
 <div class="items">1</div>
 </div>
 </div>
 </body>

</html>
<script>
 var to_right = document.getElementsByClassName('to-right')[0];
 var to_left = document.getElementsByClassName('to-left')[0];
 var banner = document.getElementsByClassName('banner')[0];
 var arr = [];
 var count = 1;

 to_right.onclick = function() {
 toRight();
 }
 
 function toRight(){
 arr.push(window.setInterval("moveLeft()", 30));
 }
 
 to_left.onclick = function() {
 toLeft();
 }

 function toLeft(){
 arr.push(window.setInterval("moveRight()", 30));
 }
 
 function moveLeft() {
 if(count < 5) {
 if(banner.offsetLeft > count * (-500)) {
 banner.style.marginLeft = banner.offsetLeft - 20 + "px";
 } else {
 for(var x in arr) {
 window.clearInterval(arr[x]);
 }
 count++;
 }
// 連接點
 }else{
 if(banner.offsetLeft > count * (-500)) {
 banner.style.marginLeft = banner.offsetLeft - 20 + "px";
 } else {
 for(var x in arr) {
 window.clearInterval(arr[x]);
 }
 count = 1;
 banner.style.marginLeft = 0 + 'px';
 }
 }
 }
 
 function moveRight() {
 if(count-1 >0) {
 if(banner.offsetLeft < (count-2) * (-500)) {
 banner.style.marginLeft = banner.offsetLeft + 20 + "px";
 } else {
 for(var x in arr) {
 window.clearInterval(arr[x]);
 }
 count--;
 }
 }
 }
 window.setInterval("toRight()",1750);
 

</script>

以上這篇利用JS做網頁特效_大圖輪播(實例講解)就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

利用JS做網頁特效_大圖輪播(實例講解)

利用JS做網頁特效_大圖輪播(實例講解):廢話不多說,直接上代碼: <style> * { margin: 0px; padding: 0px; } .stage { width: 500px; height: 300px; border: 5px solid black; margin: 200px; position: relative; overflow: hidde
推薦度:
標簽: 使用 js 大圖輪播
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 欧美在线视频网站 | 国产成人久久蜜一区二区 | 欧美啊v| 国产一区二区三区不卡免费观看 | 国产91久久久久久久免费 | 欧美另类在线观看 | 久久精品国产免费中文 | 国产精品久久久久久久毛片 | 91精品一区二区三区在线观看 | 欧美色视频在线观看 | 日韩欧美亚 | 中文字幕美日韩在线高清 | 国产ssss在线观看极品 | 夜精品a一区二区三区 | 国产青草 | 夜夜操夜夜爱 | 在线观看视频一区二区三区 | 亚洲风情第一页 | 亚洲专区欧美专区 | 国产免费资源高清小视频在线观看 | 国内一级一级毛片a免费 | 欧美3p在线观看一区二区三区 | 97r久久精品国产99国产精 | 欧美日韩国产va另类试看 | 亚洲国产精品成人综合久久久 | 亚洲精品乱码久久久久久中文字幕 | 欧美资源在线观看 | 亚洲 欧美 日韩在线一区 | 国产手机视频在线观看 | 九九久久香港经典三级精品 | 国产高清美女一级a毛片 | 成人国内精品久久久久影院 | 国产免费不卡 | 欧美日韩高清不卡免费观看 | 广东东莞一级毛片免费 | 精品久久一区二区三区 | 国产一级淫片免费播放 | 久久国产一级毛片一区二区 | 久久久国产高清 | 欧美精品午夜久久久伊人 | 久久精品亚洲一区二区 |