首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

,如何让这个效果中的图片一直居中显示

2012-09-28 
在线等,怎么让这个效果中的图片一直居中显示我先把测试地址帖上,托管在sinaAPP,如果不想看地址的话 我把代

在线等,怎么让这个效果中的图片一直居中显示
我先把测试地址帖上,托管在sinaAPP,如果不想看地址的话 我把代码帖在下面看代码也可以,求大神帮忙啊。

http://1.depaer.sinaapp.com/b/

HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title></title><style type="text/css">body {margin:0;padding:0;}#container {height:1154px;background:url(images/bg1.jpg) no-repeat center top;margin:0;padding:0;}#banner1 {width:100%;height:470px;margin:0 auto;padding-top:106px;}img{-ms-interpolation-mode:bicubic}section,article,aside,header,footer,nav,figure{display:block}body,h1,h2,h3,h4,h5,h6,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td,figure{margin:0;padding:0}/* slide */.slide{max-width:100%;height:470px;margin:0 auto;position:relative;overflow:hidden}/*修改高度*/.slide-cnt{width:100%;height:100%;position:absolute;overflow:hidden;z-index:2}.slide-cnt .slide-list{width:100%;height:100%;position:relative}.slide-cnt .slide-list li{width:100%;height:100%;position:absolute}.slide-cnt .slide-list li a{width:100%;height:100%;display:block;cursor:pointer}.slide-cnt .slide-list li a:hover{text-decoration:none}.slide-cnt .slide-page{position:absolute;z-index:10;left:50%;bottom:10px;margin-left:-52px}/*修改小点的图片*/.slide-cnt .slide-page span{display:block;float:left;width:30px;height:30px;margin-right:5px;overflow:hidden;text-indent:-30px;background:url(images/slider-sprites.png) -30px 0 no-repeat;font-style:normal;cursor:pointer}.slide-cnt .slide-page span.on{background-position:0 0;color:#fff}/* 修改下载 */.slider-download{    position:absolute;    bottom:165px;    left:380px;    z-index:3;    width:418px;    height:246px;    background:url(images/slider-download.png) 0 0 no-repeat;    _background:url(about:blank);    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/slider-download.png',sizingMethod='scale');}.slider-download-btn{    position:absolute;    display:block;    width:190px;    height:60px;    z-index:3;    _background:url(about:blank);    bottom:165px;    left:379px;    overflow:hidden}.slider-download-btn span{    position:absolute;    top:-999em;    left:0}</style></head><body><div id="container"><div id="banner1"><div class="slide">  <div id="home_slide" class="slide-cnt">    <ul class="slide-list">        <li><img src="images/banner1.jpg" alt="" /></li>        <li><img src="images/banner2.jpg" alt="" /></li>        <li><img src="images/banner3.jpg" alt="" /></li>    </ul>    <cite class="slide-page">        <span class="on">1</span>        <span>2</span>        <span>3</span>    </cite>  </div>  <div class="home_download">      <div class="slider-download"></div>      <a class="slider-download-btn" href="download.html"><span>立即下载</span></a>  </div></div></div><script>(function(){    if(!Function.prototype.bind){        Function.prototype.bind = function(obj){            var owner = this,args = Array.prototype.slice.call(arguments),callobj = Array.prototype.shift.call(args);            return function(e){e=e||top.window.event||window.event;owner.apply(callobj,args.concat([e]));};        };    }})();var glume = function(id){    this.ctn = document.getElementById(id);    this.adLis = null;    this.btns = null;    this.animStep = 0.1;//这里修改动画切换的速度0.1~0.9    this.switchSpeed = 5;//这里修改自动播放间隔(秒)    this.defOpacity = 1;    this.tmpOpacity = 1;    this.crtIndex = 0;    this.crtLi = null;    this.adLength = 0;    this.timerAnim = null;    this.timerSwitch = null;    this.init();};glume.prototype = {    fnAnim:function(toIndex){        if(this.timerAnim){window.clearTimeout(this.timerAnim);}        if(this.tmpOpacity <= 0){            this.crtLi.style.opacity = this.tmpOpacity = this.defOpacity;            this.crtLi.style.filter = 'Alpha(Opacity=' + this.defOpacity*100 + ')';            this.crtLi.style.zIndex = 0;            this.crtIndex = toIndex;            return;        }        this.crtLi.style.opacity = this.tmpOpacity = this.tmpOpacity - this.animStep;        this.crtLi.style.filter = 'Alpha(Opacity=' + this.tmpOpacity*100 + ')';        this.timerAnim = window.setTimeout(this.fnAnim.bind(this,toIndex),50);    },    fnNextIndex:function(){        return (this.crtIndex >= this.adLength-1)?0:this.crtIndex+1;    },    fnSwitch:function(toIndex){        if(this.crtIndex==toIndex){return;}        this.crtLi = this.adLis[this.crtIndex];        for(var i=0;i<this.adLength;i++){            this.adLis[i].style.zIndex = 0;        }        this.crtLi.style.zIndex = 2;        this.adLis[toIndex].style.zIndex = 1;        for(var i=0;i<this.adLength;i++){            this.btns[i].className = '';        }        this.btns[toIndex].className = 'on'        this.fnAnim(toIndex);    },    fnAutoPlay:function(){        this.fnSwitch(this.fnNextIndex());    },    fnPlay:function(){        this.timerSwitch = window.setInterval(this.fnAutoPlay.bind(this),this.switchSpeed*1000);    },    fnStopPlay:function(){        window.clearTimeout(this.timerSwitch);    },    init:function(){        this.adLis = this.ctn.getElementsByTagName('li');        this.btns = this.ctn.getElementsByTagName('cite')[0].getElementsByTagName('span');        this.adLength = this.adLis.length;        for(var i=0,l=this.btns.length;i<l;i++){            with({i:i}){                this.btns[i].index = i;                this.btns[i].onclick = this.fnSwitch.bind(this,i);                this.btns[i].onclick = this.fnSwitch.bind(this,i);            }        }                this.fnPlay();        this.ctn.onmouseover = this.fnStopPlay.bind(this);        this.ctn.onmouseout = this.fnPlay.bind(this);    }};var player1 = new glume('home_slide');</script></body></html> 



[解决办法]
CSS code
#container {height:1154px;background:url(http://1.depaer.sinaapp.com/b/images/bg1.jpg) no-repeat fixed top center;margin:0;padding:0;}.slide-cnt{width:100%;height:100%;position:fixed;overflow:hidden;z-index:2} 

热点排行