• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

js 实现图片翻页问题!

Title     * {            margin: 0;            padding: 0;        }        #box {            width: 700px;            height: 300px;            border: 1px solid #ccc;            margin: 20px auto;            position: relative;            overflow: hidden;        }        /* .box:hover .right-a,.box:hover .left-a{             display: block;         }*/ #box #title {            height: 30px;            width: 100%;            background: #eee;            position: relative;        }        #box #title a {            text-decoration: none;            width: 20%;            height: 100%;            line-height: 30px;            font-size: 15px;            color: #009797;            float: left;            text-align: center;            position: relative;            } #box #content {            width: 700px;            height: 270px;            position: relative;        }        #box #content #main{            width:3500px;            height: 270px;            position: absolute;            left:0;            top:0;        }        #box #content #main div {            width: 700px;            height: 270px;            float: left;            color: white;            font-size: 50px;            text-align: center;            line-height: 270px;        }        #box #left-a {            height: 70px;            width: 50px;            background: rgba(0, 0, 0, 0.5);            position: absolute;            left: 0;            top: 45%;            color: white;            font-size: 20px;            line-height: 70px;            text-align: center;            cursor: pointer;            display: none;        }        #box #right-a {            height: 70px;            width: 50px;            background: rgba(0, 0, 0, 0.5);            position: absolute;            top: 45%;            right: 0;            color: white;            font-size: 20px;            line-height: 70px;            text-align: center;            cursor: pointer;            display: none;        }        #box #content #main #color1 {            background: #ffb12f;        }        #box #content #main #color2 {            background: #00C378;        }        #box #content #main #color3 {            background: #26B2E3;        }        #box #content #main #color4 {            background: #E84C3D;        }        #box #content #main #color5 {            background: #F831FD;        }                1        2        3        4        5  
                        page1
            page2
            page3
            page4
            page5
        
   
    &lt
    &gt

下面是js的内容window.onload = function () {    var box = document.getElementById('box');    var oTitle = document.getElementById('title');    var links = oTitle.getElementsByTagName('a');    var float = document.getElementById('float');    var oContent = document.getElementById('content');    //var divs = oContent.getElementsByTagName('div');    var oLeft = document.getElementById('left-a');    var oRight = document.getElementById('right-a');    var oMain = document.getElementById('main');    var timer = null;    var num1 = 0;    var num2 = 0;    box.onmouseover = function () {        oLeft.style.display = 'block';        oRight.style.display = 'block';    }    box.onmouseout = function () {        oLeft.style.display = 'none';        oRight.style.display = 'none';    }    for(var i=0;i

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

给你个思路...
你排图片是1 2 3 4 5,
现在需要排成5 1 2 3 4 5 1,
点击的时候判断,如果点击5,并且当前在1,就会往回退,动画结束后位置弹到第二个5,
             如果点击1,并且当前在5,就会往前进,动画结束后位置弹到第一个1,

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!