肖像查看器的制作代码分分快三计划

作者:分分快三计划

      width:25px;

一款不错可用于商量的自动播放带缓存效果的图片切换效果,各位有需要了解的朋友不防进入参考。

</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ";
<html xmlns=";
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>自动播放——幻灯片缓冲效果</title>
<style>
body,div,ul,li{margin:0;padding:0;}
ul{list-style-type:none;}
body{background:#000;text-align:center;font:12px/20px Arial;}
#box{position:relative;width:492px;height:172px;background:#fff;border-radius:5px;border:8px solid #fff;margin:10px auto;cursor:pointer;}
#box .list{position:relative;width:490px;height:170px;overflow:hidden;}
#box .list ul{position:absolute;top:0;left:0;}
#box .list li{width:490px;height:170px;overflow:hidden;}
#box .count{position:absolute;right:0;bottom:5px;}
#box .count li{color:#fff;float:left;width:20px;height:20px;cursor:pointer;margin-right:5px;overflow:hidden;background:#F90;opacity:0.7;filter:alpha(opacity=70);border-radius:20px;}
#box .count li.current{color:#fff;opacity:1;filter:alpha(opacity=100);font-weight:700;background:#f60;}
#tmp{width:100px;height:100px;background:red;position:absolute;}
</style>
<script type="text/javascript">
window.onload = function ()
{
 var oBox = document.getElementById("box");
 var oList = oBox.getElementsByTagName("ul")[0];
 var aImg = oBox.getElementsByTagName("img");
 var timer = playTimer = null;
 var index = i = 0;
 var bOrder = true;
 var aTmp = [];
 var aBtn = null;
 
 //生成数字按钮
 for (i = 0; i < aImg.length; i ) aTmp.push("<li>" (i 1) "</li>");
 
 //插入元素
 var oCount = document.createElement("ul");
 oCount.className = "count";
 oCount.innerHTML = aTmp.join("");
 oBox.appendChild(oCount); 
 aBtn = oBox.getElementsByTagName("ul")[1].getElementsByTagName("li");
 
 //初始化状态
 cutover();
 
 //按钮点击切换
 for (i = 0; i < aBtn.length; i )
 {
  aBtn[i].index = i;
  aBtn[i].onmouseover = function ()
  {
   index = this.index;
   cutover()
  }
 }
 
 function cutover()
 {
  for (i = 0; i < aBtn.length; i ) aBtn[i].className = "";
  aBtn[index].className = "current";   
  startMove(-(index * aImg[0].offsetHeight))
 }
 
 function next()
 {
  bOrder ? index : index--;
  index <= 0 && (index = 0, bOrder = true);
  index >= aBtn.length - 1 && (index = aBtn.length - 1, bOrder = false)
  cutover()
 }
 
 playTimer = setInterval(next, 3000);
 
 //鼠标移入展示区停止自动播放
 oBox.onmouseover = function ()
 {
  clearInterval(playTimer)
 };
 
 //鼠标离开展示区开始自动播放
 oBox.onmouseout = function ()
 {
  playTimer = setInterval(next, 3000)
 };
 function startMove(iTarget)
 {
  clearInterval(timer);
  timer = setInterval(function ()
  {
   doMove(iTarget)
  }, 30) 
 }
 function doMove (iTarget)
 {  
  var iSpeed = (iTarget - oList.offsetTop) / 10;
  iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);  
  oList.offsetTop == iTarget ? clearInterval(timer) : oList.style.top = oList.offsetTop iSpeed "px"
 }
};
</script>
</head>
<body>
<div id="box">
    <div class="list">
        <ul>
            <li><img src="img/01.jpg" width="490" height="170" /></li>
            <li><img src="img/02.jpg" width="490" height="170" /></li>
            <li><img src="img/03.jpg" width="490" height="170" /></li>
            <li><img src="img/04.jpg" width="490" height="170" /></li>
            <li><img src="img/05.jpg" width="490" height="170" /></li>
        </ul>
    </div>
</div>
</body>

      var  box=document.getElementById("box");

复制代码

        <li><img src="img/5.jpg"></li>

代码如下 复制代码 !DOCTYPE html PUBLIC -...

        var newDiv=document.createElement('div').

 代码如下

        newDiv.className='mark';

      width:600px;

}

      opacity:0.5;

      width:200px;

}

}

      //先获取元素

      </ul>

#box ul li img{

}

}

.pho{

      top:50px;

      position:absolute;

      background-color:#000;

    padding:0;

        <li><img src="img/2.jpg"></li>

</body>

        newImg.className='pho';

      //遍历li中的图片

        <li><img src="img/6.jpg"></li>

      var lis=document.getElementsByTagName('li');

      width:200px;

    </div>

          box.removeChild(newImg);

        newImg.src=this.firstChild.getAttruibute('src');

      widht:400px;

        //关闭图层

        //创建新的图片层,找到src属性,追加到box中。

        box.appendChild(newSpan);

<html>

}

      text-align:center;

        var newImg=document.createElement('img');

          box.removeChild(newSpan);

      <ul>

        box.appendChild(newImg);

      height:200px;

      cursor:pointer;

}

        //创建一个关闭span。

        var newSpan=document.createElement(''span');

    margin:0;

      for(var i=0,len=lis.length;i<len;i ){

<style>

<body>

        newSpan.className='close';

#box ul li{

      left:500px;

        box.appendChild(newDiv);

</script>

      left:50%;

        //追加到box中

}

    <div id="box">

      top:50%;

.close{

      margin-top:-100px;

}

<!doctype html>

        //创建一个新层,设为模糊。

</style>

#box{  

        lis[i].onclick=function(){

<meta charset="utf-8">

        <li><img src="img/1.jpg "></li>

        newSpan.onclick=function(){

      height:150px;

}

      list-style:none;

      height:25px;

/*基础样式一定要记得清除,或者会对布局造成影响。*/

    width:600px;height:300px;margin:100 auto;position:relative;

<title>照片查看器</title>

      background-color:red;

      float:left;

      margin-left:-200px;

<script>

      height:300px;

        <li><img src="img/3.jpg"></li>

          box.removeChild(newDiv);

      position:absolute;

        <li><img src="img/4.jpg"></li>

/*样式的设置根据自己的素材及布局来设置。*/

      height:150px;

*{

.mark{

本文由分分快三计划发布,转载请注明来源

关键词: 分分快三计划