自动滚动图片JS滚着滚着就没有了以下是全部的代码,有没有哪位朋友帮忙分析一下是哪里问题呢.CSS codestyl
自动滚动图片JS滚着滚着就没有了
以下是全部的代码,有没有哪位朋友帮忙分析一下是哪里问题呢.
- CSS code
<style type="text/css"><!--#RBottom_Main{ width:736px; height:160px; overflow:hidden;}.BMLeftArr1{ float:left; width:12px; cursor: pointer; height:160px; margin:0px; line-height:160px;}.BMISL_Cont{ float:left; width:712px; height:160px; margin:0px; overflow: hidden;}.pic{ float:left; text-align:center; margin:0px; padding:0px; width:356px; height:160px;}.BMRightArr1{ float:left; width:12px; cursor: pointer; height:160px; line-height:160px;}.ScrCont{width:10000000px;}.#List1,#List2{float:left;}--></style>- HTML code
<div id="RBottom_Main"> <div class="BMLeftArr1" onmousedown="ISL_GoUp()" onmouseup="ISL_StopUp()" onmouseout="ISL_StopUp()"><</div> <div class="BMISL_Cont" id="ISL_Cont"> <div class="ScrCont"> <!-- 图片列表 begin --> <div id="List1"> <div class="pic" style="background-color:#0000FF"></div> <div class="pic" style="background-color:#00FFFF"></div> <div class="pic" style="background-color:#000000"></div> </div> <!-- 图片列表 end --> <div id="List2"></div> </div> </div> <div class="BMRightArr1" onmousedown="ISL_GoDown()" onmouseup="ISL_StopDown()" onmouseout="ISL_StopDown()">></div> </div></div>
- JScript code
<script language="javascript" type="text/javascript"><!--//--><![CDATA[//><!--//图片滚动列表 5icool.orgvar Speed = 1; //速度(毫秒)var Space = 5; //每次移动(px)var PageWidth = 356; //翻页宽度var fill = 0; //整体移位var MoveLock = false;var MoveTimeObj;var Comp = 0;var AutoPlayObj = null;GetObj("List2").innerHTML = GetObj("List1").innerHTML;GetObj('ISL_Cont').scrollLeft = fill;GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);}GetObj("ISL_Cont").onmouseout = function(){AutoPlay();}AutoPlay();function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}function AutoPlay(){ //自动滚动clearInterval(AutoPlayObj);AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',3000); //间隔时间}function ISL_GoUp(){ //上翻开始 if(MoveLock) return; clearInterval(AutoPlayObj); MoveLock = true; MoveTimeObj = setInterval('ISL_ScrUp();',Speed);}function ISL_StopUp(){ //上翻停止 clearInterval(MoveTimeObj); if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){ Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth); CompScr(); }else{ MoveLock = false; } AutoPlay();}function ISL_ScrUp(){ //上翻动作 if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth} GetObj('ISL_Cont').scrollLeft -= Space ;}function ISL_GoDown(){ //下翻 clearInterval(MoveTimeObj); if(MoveLock) return; clearInterval(AutoPlayObj); MoveLock = true; ISL_ScrDown(); MoveTimeObj = setInterval('ISL_ScrDown()',Speed);}function ISL_StopDown(){ //下翻停止 clearInterval(MoveTimeObj); if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){ Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill; CompScr(); }else{ MoveLock = false; } AutoPlay();}function ISL_ScrDown(){ //下翻动作 if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;} GetObj('ISL_Cont').scrollLeft += Space ;}function CompScr(){ var num; if(Comp == 0){MoveLock = false;return;} if(Comp < 0){ //上翻 if(Comp < -Space){ Comp += Space; num = Space; }else{ num = -Comp; Comp = 0; } GetObj('ISL_Cont').scrollLeft -= num; setTimeout('CompScr()',Speed); }else{ //下翻 if(Comp > Space){ Comp -= Space; num = Space; }else{ num = Comp; Comp = 0; } GetObj('ISL_Cont').scrollLeft += num; setTimeout('CompScr()',Speed); }}//--><!]]></script>
[解决办法]
你改了人家的css,又偏偏不一个一个的对着改
你自己的css修正如下:
- CSS code
#RBottom_Main{width:704px;overflow:hidden;padding:12px 0 5px 6px;margin:0 auto;} .BMLeftArr1{height:52px;width:19px;background:url(button.gif) no-repeat 11px 0;overflow:hidden;float:left;display:inline;margin:25px 0 0 0;cursor:pointer;} .BMRightArr1{height:52px;width:20px;background:url(button.gif) no-repeat -8px 0;overflow:hidden;float:left;display:inline;margin:25px 0 0 0;cursor:pointer;} .BMISL_Cont{width:327px;overflow:hidden;float:left;} .ScrCont{width:10000000px;} .BMISL_Cont .pic{width:132px;float:left;text-align:center;} .BMISL_Cont .pic img{padding:4px;background:#fff;border:1px solid #ccc;display:block;margin:0 auto;} .BMISL_Cont .pic p{line-height:26px;color:#505050;} .BMISL_Cont a:link,.rollBox .Cont a:visited{color:#626466;text-decoration:none;} .BMISL_Cont a:hover{color:#f00;text-decoration:underline;} #List1,.rollBox #List2{float:left;} 