• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專題視頻專題問答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
    主站蜘蛛池模板: 国产在线不卡午夜精品2021| 国产精品国产高清国产专区| 国产成人无码精品久久久免费| 亚洲av成人无码久久精品| 国产成人亚洲精品91专区手机 | 国产成人精品免费视频大| 麻豆精品| 国产精品无码素人福利不卡| 国产精品久久网| 国产伦精品一区二区三区| 亚洲精品456播放| 国产精品无码久久四虎| 国产在视频线精品视频二代| 国产午夜精品无码| 亚洲AV第一页国产精品| 国产精品成人免费观看| 久久五月精品中文字幕| 97久久精品人人做人人爽| 久久er热视频在这里精品| 国产精品国色综合久久| 嫩草伊人久久精品少妇AV| 一本色道久久88精品综合| 亚洲精品视频久久久| 久久久久人妻一区精品| 精品福利一区二区三区| 国产情侣大量精品视频| 国产精品嫩草影院久久| 国产精品成人免费观看 | 国产成人精品一区二区三区| 欧美精品免费观看二区| 精品国产91久久久久久久| 91麻豆国产福利精品| 2020亚洲男人天堂精品| 92国产精品午夜福利| 99久久99久久久精品齐齐| 国产精品毛片VA一区二区三区| 国产欧美精品AAAAAA片| 国产精品18久久久久久vr| 精品国产网红福利在线观看| 日本一区二区三区精品中文字幕| 午夜精品成年片色多多|