如题,自己调用的时候就不正常显示了。本来以为是把js css分开的原因 结果发现不是 重新定义一个页面 什么都没有的情况下,幻灯片能正常让几个图片正常轮转,我的只能让他们在第一页叠加 还没彻底隐藏好,js那段代码没太看懂就没敢改。求指教 我的代码 难道是我定义的css有问题 限制了position?我的代码如下:
html:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/homepage.css">
<link rel="stylesheet" type="text/css" href="css/glide.css"><title>无标题文档</title>
</head>    
<body>
     <div id="container">
      <div id="head">
        <div class="first">
      <div class="logo">
     <img src="image/logo.png"/>
  </div>
  <div class="logobanner">
     
      <div class="logotitle">
       <font face="幼圆" size="+3" >让我们烙旅途下每一次!</font>   </div>
  <div id="logintitle" onMouseDown="login.style="display:block"">
      登录
  </div>
  <div id="login" style="display:none"></div>
  </div>
</div>
                <div class="nav">
</div>
<div class="menu">
      <ul>    
       <li><a href="">目的地</a></li>
   <li><a href="">个人足迹</a></li>
   <li><a href="">心得感悟</a></li>
   <li><a href="">穷游小技巧</a></li>
   <li><a href="">自驾小攻略</a></li>
   
  </ul>
</div>
<div class="nav">
</div>
<div class="search">
           景点搜索:      热门景点      冷门却好玩
</div>
<div class="nav">
</div>

  </div>
  <div id="content">
        <div class="footprint">
     <div class="footprint1">
         <img src="image/printleft.png"/>
 </div>
 <div class="footprint2">
        <img src="image/print.png"/>
 </div>
</div>
<div class="slideshow">
      <div id="picBox">
<ul id="show_pic" style="left:0;">
     <li><img src="http://inncache.soso.com/pc/images/manage.jpg" width="610" height="205" alt="" title="" /></li>
        <li><img src="http://inncache.soso.com/pc/images/player.jpg" width="610" height="205" alt="" title="" /></li>
        <li><img src="http://inncache.soso.com/pc/images/py.jpg" width="610" height="205" alt="" title="" /></li>
        <li><img src="http://inncache.soso.com/pc/images/xf.jpg" width="610" height="205" alt="" title="" /></li>
        <li><img src="http://inncache.soso.com/pc/images/TT.jpg" width="610" height="205" alt="" title="" /></li>
    </ul>
    <ul id="icon_num">
     <li class="active">1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
</div><script type="text/javascript" src="javascript/slideshow.js"></script>
</div>
  


</div>
<div class="nav">
</div>

<div class="most1">
最多人去的
</div>
<div class="most2">
最多人想去的
</div>
<div class="most3">
门票价格排行榜
</div>
<div class="nav">
</div>
<div class="bbs">
做个论坛
<div class="nav">
</div>
  </div>
  <div id="buttom">
        <div class="function">
注册  联系我们  了解我们 
</div>
<div class="copyright">
</div>
  </div> 
 </div></body>
</html>css@charset "utf-8";
/* CSS Document */body{
margin:0px;
padding:0px;
text-align:center;
background:#CCCC99;
font-family: Arial, "宋体";
font-size: 12px;
  
  }#container{
      margin-left:auto;
  margin-right:auto;
  width:960px;
  

  }#head{
      float:left;
  
  
  width:100%;
  } 
#head .first{      float:left;
  width:100%;
  height:191px;
  background:white;
     }
.first .logo{
      float:left;
  margin:0px;
  padding:0px;
  background:url(../image/logo.png);
  height:191px;
  width:150px;
  }
.first .logobanner{
      
      float:left;
  margin:0px;
  padding:0px;
  width:810px;
  height:191px;
  background:url(../image/logobanner.png);
  }
.logobanner .logotitle{
      position:absolute;
  left:350px;
  top:30px;
  }
#login{
      float:right;
  top:0px;
  left:850px;
  width:185px;
  height:191px;
  background:white;
  }
#logintitle{
      float:right;
  top:5px;
  }
#head .menu{
      float:left;
  height:40px;
  width:100%;
  background:purple;
  
  }
.menu a{
      color:white;
  text-decoration:none;
  
  }
#head .search{
      float:left;
  height:25px;
  width:100%;
  background:lime;
  }
  
#content{
      float:left;
  
  background:red;
  width:100%;
  }
#content .footprint{
      float:right;
  height:350px;
 
  width:250px;
  }
.footprint .footprint1{
      float:left;
  width:125px;
  height:135px;
  
 
  }
.footprint .footprint2{
      float:right;
  
  
 
  }
#content .slideshow{
      float:left;
  height:350px;
  background:#999900;
  width:700px;
  }
#content .most1{
      float:left;
  height:300px;
  background:#999900;
  width:310px;
  }
#content .most2{
      margin-left:15px;
      float:left;
  height:300px;
  background:lime;
  width:310px;
  }
#content .most3{
      float:right;
  height:300px;
  background:pink;
  width:310px;
  }
#content .bbs{
      float:left;
  height:300px;
  background:grey;
  width:100%;
  }
#buttom{
      float:left;
  background:blue;
  width:100%;
  }
#buttom .function{
      float:left;
  height:200px;
  width:100%;
  background:#FFFF00;
  }
#buttom .copyright{
      float:left;
  height:50px;
  width:100%;
  }
 
.nav{
      
      width:100%;
  height:10px;
  background:#CCCCCC;
  clear:both;
  overflow:hidden;
  }
ul{
  margin:0px;
  padding:0px;
  list-style:none;
  }
li{   float:left;
      width:80px;
  }
js:/**
 *glide.layerGlide((oEventCont,oSlider,sSingleSize,sec,fSpeed,point);
 *@param auto type:bolean 是否自动滑动 当值是true的时候 为自动滑动
 *@param oEventCont type:object 包含事件点击对象的容器
 *@param oSlider type:object 滑动对象
 *@param sSingleSize type:number 滑动对象里单个元素的尺寸(width或者height)  尺寸是有point 决定
 *@param second type:number 自动滑动的延迟时间  单位/秒
 *@param fSpeed type:float   速率 取值在0.05--1之间 当取值是1时  没有滑动效果
 *@param point type:string   left or top
 */
var glide =new function(){
function $id(id){return document.getElementById(id);};
this.layerGlide=function(auto,oEventCont,oSlider,sSingleSize,second,fSpeed,point){
var oSubLi = $id(oEventCont).getElementsByTagName('li');
var interval,timeout,oslideRange;
var time=1; 
var speed = fSpeed 
var sum = oSubLi.length;
var a=0;
var delay=second * 1000; 
var setValLeft=function(s){
return function(){
oslideRange = Math.abs(parseInt($id(oSlider).style[point]));
$id(oSlider).style[point] =-Math.floor(oslideRange+(parseInt(s*sSingleSize) - oslideRange)*speed) +'px';
if(oslideRange==[(sSingleSize * s)]){
clearInterval(interval);
a=s;
}
}
};
var setValRight=function(s){
return function(){  
oslideRange = Math.abs(parseInt($id(oSlider).style[point]));
$id(oSlider).style[point] =-Math.ceil(oslideRange+(parseInt(s*sSingleSize) - oslideRange)*speed) +'px';
if(oslideRange==[(sSingleSize * s)]){
clearInterval(interval);
a=s;
}
}
}

function autoGlide(){
for(var c=0;c<sum;c++){oSubLi[c].className='';};
clearTimeout(interval);
if(a==(parseInt(sum)-1)){
for(var c=0;c<sum;c++){oSubLi[c].className='';};
a=0;
oSubLi[a].className="active";
interval = setInterval(setValLeft(a),time);
timeout = setTimeout(autoGlide,delay);
}else{
a++;
oSubLi[a].className="active";
interval = setInterval(setValRight(a),time);
timeout = setTimeout(autoGlide,delay);
}
}

if(auto){timeout = setTimeout(autoGlide,delay);};
for(var i=0;i<sum;i++){
oSubLi[i].onmouseover = (function(i){
return function(){
for(var c=0;c<sum;c++){oSubLi[c].className='';};
clearTimeout(timeout);
clearInterval(interval);
oSubLi[i].className="active";
if(Math.abs(parseInt($id(oSlider).style[point]))>[(sSingleSize * i)]){
interval = setInterval(setValLeft(i),time);
this.onmouseout=function(){if(auto){timeout = setTimeout(autoGlide,delay);};};
}else if(Math.abs(parseInt($id(oSlider).style[point]))<[(sSingleSize * i)]){
interval = setInterval(setValRight(i),time);
this.onmouseout=function(){if(auto){timeout = setTimeout(autoGlide,delay);};};
}
}
})(i)
}
}
}
glide.layerGlide(true,'icon_num','show_pic',610,2,0.1,'left');jshtml

解决方案 »

  1.   

    这个是那个 glide 幻灯片的css@charset "utf-8";
    /* CSS Document */
    body{ font-size:12px; color:#333;}
    #picBox{width:610px; height:205px; margin:50px auto; overflow:hidden; position:relative;}
    #picBox ul#show_pic{ margin:0; padding:0; list-style:none; height:205px; width:3050px; position:absolute;}
    #picBox ul#show_pic li{ float:left; margin:0; padding:0; height:205px;}
    #picBox ul#show_pic li img{ display:block;}
    #icon_num{ position:absolute; bottom:0px; right:10px;}
    #icon_num li{ float:left; background:url(http://pc.qq.com/pc/images/flashbutton.gif) no-repeat -15px 0;width:15px; height:15px; list-style:none; color:#39F; text-align:center;  cursor:pointer; padding:0; margin:0;margin-right:5px;}
    #icon_num li:hover,#icon_num li.active{ background:url(http://pc.qq.com/pc/images/flashbutton.gif) no-repeat 0 0; color:#fff;}
    #picBox_top{width:610px; height:205px; margin:50px auto; position:relative; overflow:hidden;}
    #picBox_top ul#show_pic_top{ margin:0; padding:0; list-style:none; height:205px; width:610px; position:absolute;}
    #picBox_top ul#show_pic_top li{ float:left; margin:0; padding:0; height:205px;}
    #picBox_top ul#show_pic_top li img{ display:block;}
    #icon_num_top{ position:absolute; bottom:0px; right:10px;}
    #icon_num_top li{ float:left; background:url(http://pc.qq.com/pc/images/flashbutton.gif) no-repeat -15px 0;width:15px; height:15px; list-style:none; color:#39F; text-align:center;  cursor:pointer; padding:0; margin:0;margin-right:5px;}
    #icon_num_top li:hover,#icon_num_top li.active{ background:url(http://pc.qq.com/pc/images/flashbutton.gif) no-repeat 0 0; color:#fff;}