zoukankan      html  css  js  c++  java
  • python 轮播效果源代码

    <!doctype html>
    <html>
    <meta charset="utf-8">
    <head>
    <title>轮播效果</title>
        <style>
        *{
            margin: 0px ;
            padding: 0px;
            }
    
        body {
            background: green;
            }
        .box{
             600px;
            height: 400px;
            margin: 50px auto;
            overflow:hidden;
            position: relative;
            }
        .ctrl{
             50px;
            height: 50px;
            color: red;
            font-size: 50px;
            text-align:center;
            line-height:50px;
            background: none;
            border: none;
            outline: none;
            cursor: pointer;
            position: absolute;
            z-index: 10;
            top: 40%;
            display: none;
            }
        .next {
                    right: 0;
                }
        .content{
             1800px;
            height: 400px;
            position: relative;
            left:-600px;
            }
        img {
                  display: block;
                float: left;
                 600px;
                height: 400px;
            }
        .dot{
             100%;
            height: 50px;
            background: aqua;
            position: relative;
            bottom: 50px;
            text-align: center;
            line-height: 50px;
        }
         .dot div {
         display: inline-block;
          14px;
         height: 14px;
         background: white;
         border: 1px solid red;
         border-radius: 8px;
         }
         .dot .selected{
         background: purple;
         font-weight: bold;
         }
        </style>
    </head>
    <body>
    <div class="box">
         <button class="ctrl prev"><</button>
         <button class="ctrl next"> > </button>
        <div class="content">
            <img src="03.jpg" >#写你自己的图片路径就可以了
            <img src="01.jpg" >
            <img src="02.jpg" >
        </div>
        <div class="dot">
             <div  class="selected"></div>
             <div></div>
             <div></div>
    
    
        </div>
    
    </div>
    </body>
    <script type="text/javascript" src="jquery-1.11.3.min.js"></script>
    <script >
    $(function() {
        //记录现实的序号
        var index=0
    
    $('.box').hover(function() {
      $('.ctrl').show(300)
    },function() {
       $('.ctrl').hide(300)
    })
    //prev 按钮
    $('.prev').click(function() {
        //若内容正在动画,则立即返回
        if ($('.content').is(':animated')){
            return
        }
      $('.content').animate({left:0},'slow','linear',function() {
        //动画结束后,将最后一张图查到最开头
          $('.content').prepend($('img:last'))
          //重新设置偏移
           $('.content').css('left','-600px')
           //记录图片序号
           if(--index==-1){
               index=2
           }
           $('.dot div').eq(index).addClass('selected').siblings().
           removeClass('selected')
      })
         $('.dot div').eq(index).click()
    
    })
     //next 按钮
     $('.next').click(function() {
         //若内容正在动画,则立即返回
         if ($('.content').is(':animated')){
             return
         }
       $('.content').animate({left:'-1200px'},'slow','linear',function() {
         //动画结束后,将最后一张图查到最开头
           $('.content').append($('img:first'))
           //重新设置偏移
            $('.content').css('right','-600px')
            if(++index==3)  {
               index=0
            }
             $('.dot div').eq(index).addClass('selected').siblings().
             removeClass('selected')
       })
    
    
     })
    
    })
    </script>
    </html>
  • 相关阅读:
    App测试从入门到精通之安装、卸载和运行测试
    App测试从入门到精通之App分类和场景操作系统
    一步到位带你入门Selenium
    MAMP和WAMP搭建Web环境,数据库,数据分布可视化
    爬虫 Http请求,urllib2获取数据,第三方库requests获取数据,BeautifulSoup处理数据,使用Chrome浏览器开发者工具显示检查网页源代码,json模块的dumps,loads,dump,load方法介绍
    Python 基本语法,文件读写,数据结构和类型
    python 数据工程 and 开发工具Sublime
    jieba user guide
    python各类项目模块记录
    python parse xml using DOM
  • 原文地址:https://www.cnblogs.com/liangliangzz/p/10159806.html
Copyright © 2011-2022 走看看