zoukankan      html  css  js  c++  java
  • 我的大图轮播的程序

    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
        </head>
        <style>
    
    * {
                    margin: 0px;
                    padding: 0px;
                }
                
                .stage {
                     430px;
                    height: 400px;
                    border: 5px solid black;
                    margin: 200px;
                    position: relative;
                    overflow: hidden;
                }
                
                .to-left,
                .to-right {
                    position: absolute;
                    top: 0px;
                     50px;
                    height: 400px;
                    background-color: black;
                    color: white;
                    font-size: 30px;
                    text-align: center;
                    line-height: 400px;
                    opacity: 0.3;
                }
                
                .to-left {
                    left: 0px;
                }
                
                .to-right {
                    right: 0px;
                }
                
                .to-left:hover,
                .to-right:hover {
                    cursor: pointer;
                    opacity: 0.5;
                }
                
                .banner {
                     2500px;
                    height: 300px;
                }
                
                .items {
                    float: left;
                     430px;
                    height: 400px;
                    background-color: blanchedalmond;
                    font-size: 100px;
                    text-align: center;
                    line-height: 300px;
                }
        </style>
        
        <body>
            <div class="stage">
                    <div class="to-left"><</div>
                    <div class="to-right">></div>
                    
                    <div class="banner">
                        <div class="items"><img class="popMUSIC" src="./img/摇滚3.jpg"  height="400px" width="430px"></div>
                    
                    
                    <div class="items" ><img class="photo-2" src="./img/摇滚6.jpg" height="400px" width="430px"></div>
                        
                    <div class="items" ><img class="popMUSIC" src="./img/摇滚.jpg"  height="400px" width="430px"></div>
                        
                    
                    <div class="items" ><img class="popMUSIC" src="./img/摇滚7.jpg"  height="400px" width="430px" ></div>
                        
                        
                    
                    <div class="items" ><img class="popMUSIC" src="./img/摇滚5.jpg"  height="400px" width="430px"></div>
                        
                    </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));
        }
        function moveleft(){
            if(count<5){
                if(banner.offsetLeft>count*(-430)){
            banner.style.marginLeft =banner.offsetLeft -20+'px';
            }else{
                for( var x in arr){
                    window.clearInterval(arr[x]);
                }
                count++;
            }
        }
    }
  • 相关阅读:
    ABP 番外篇-容器
    ABP 番外篇-菜单
    三、写服务
    十二、异步
    一、PHP_OSS使用
    十一、泛型
    Automapper
    ABP实践学习
    【2019-07-26】省是缺点
    【2019-07-25】女人,很强大
  • 原文地址:https://www.cnblogs.com/sunbo123/p/7356861.html
Copyright © 2011-2022 走看看