. . .

用户名

密码

搜索内容 搜索类别
   
  首 页 |    公司简介 |    建站套餐 |    建站指南 |    新手上路 |    网络资讯 |    编辑技巧 |    网页设计 |    网页特效 |    HTML教程 |    代理加盟 |    域名查询 |    域名邮箱 |    幽默笑话 |    付款方式 | 

 

仿FLASH的漂亮的图片轮播效果
发布时间 2010-03-27

效果预览

以下是代码片段:


<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="generator" content="editplus" />
<meta name="author" content="eLore" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<style type="text/css">
* { margin:0; padding:0; }
body {
 margin:5px auto;
 text-align:center;
 background:#f0f0f0;
}
img { margin:0; border:0; padding:0; }
#eLore {
 position:relative;
 margin:0 auto;
 width:800px; height:339px;
}
#eLore_wrap {
 position:relative;
 margin:0 auto;
 overflow:hidden;
 width:400px; height:200px;
 background:#369;
 z-index:5;
}
#eLore .eLore_img {
 position:absolute; top:0;
 overflow:hidden;
}
#eLore .eLore_out {
 position:absolute;
 right:0; top:0;
 overflow:hidden;
}
</style>
</head>
<body>
<div id="eLore">
 <div id="eLore_wrap">Loading...</div>
</div>
<div id="debug"></div>
<script type="text/javascript">
//<[CDATA[
var eLore_wrap = document.getElementById('eLore_wrap');
var iImg = 0;
var iA = 0;
var aImg = [
 'http://www.16ox.com/userlist/admin/data/userpic/2009011321786.gif',
 'http://gg.blueidea.com/2008/blueidea/job.gif',
 'http://gg.blueidea.com/2008/blueidea/job2.gif',
 'http://gg.blueidea.com/2008/blueidea/job.gif'
 ];
var iImgWidth = 317, iImgHeight = 104;
var iDivWidth = iImgWidth/10;
eLore_wrap.style.width = 10*(Math.floor(iImgWidth/10)) + 'px';
eLore_wrap.style.height = iImgHeight + 'px';
eLore_createD();
function eLore_createD() {
 if (iImg==10) {
  eLore_wrap.innerHTML = '';
  iImg = 0;
 }
 if (iImg==0) {
  var oDivOut = document.createElement('div');
  oDivOut.className = 'eLore_out';
  oDivOut.style.width = iDivWidth + 'px';
  oDivOut.style.height = iImgHeight + 'px';
  oDivOut.style.background = 'url(' + aImg[iA] + ') -' + parseInt(8.5*iDivWidth) + 'px top no-repeat';
  eLore_wrap.appendChild(oDivOut);
 }
 var oDiv = document.createElement('div');
 oDiv.className = 'eLore_img';
 oDiv.style.right = iImg*iDivWidth +'px';
 oDiv.style.width = 1.5*iDivWidth + 'px';
 oDiv.style.height = iImgHeight + 'px';
 oDiv.style.background = 'url(' + aImg[iA] + ') -' + 9*iDivWidth + 'px top no-repeat';
 eLore_wrap.appendChild(oDiv);
 iImg++;
 eLore_move();
}
function eLore_move(){
 var oDiv = eLore_wrap.getElementsByTagName('div');
 for (var i=1; i<oDiv.length; i++) {
  var iBgpx = parseInt(oDiv[i].style.backgroundPosition);
  if (iBgpx<i*iDivWidth-(iImgWidth-0.5*iDivWidth)) {
   var iMovePx = Math.floor((iImgWidth-0.5*iDivWidth-i*iDivWidth+iBgpx)/15);
   oDiv[i].style.backgroundPosition = iBgpx - iMovePx + 'px top';
  } else {
   oDiv[i].style.backgroundPosition = ((i+0.5)*iDivWidth-iImgWidth) + 'px top';
  }
 }
 //document.getElementById('debug').innerText = eLore_wrap.innerHTML;
 if (iImg<10) {
  setTimeout('eLore_createD()','60');
 } else if (parseInt(oDiv[10].style.backgroundPosition)<0.5*iDivWidth) {
  setTimeout('eLore_move()','60');
 } else {
  iA = ++iA==aImg.length ? 0 : iA;
  setTimeout('eLore_createD()','2000');
 }
}
//]]>
</script>
</body>
</html>



 

[ 点击数:] [打印本网页] [关闭本窗口]
  相关内容  
  查无记录  

      开户:农业银行宝山友谊支路行 开户:建设银行上海宝山团结路支行 开户:上海浦东发展银行宝山支行
      户名:黄能伟 户名:黄能伟    户名:黄能伟
      账号:9559 9800 3057 2120 514  账号:4367 4212 1620 4242 137   账号:9843 0301 0146 5200
       地址:上海市宝山区友谊支路304号    电话:02156607372   联系人:黄能伟   手机:13901838552
       Email: fengdi021@163.com   备案序号:沪ICP备11025785号                    网站管理