|
热门文章 |
|
|
|
相关文章 |
|
没有相关文章 |
|
|
JS 图片左右滚动,图片控制左右滚动 |
来源:幽暗之灵 更新时间:2010/8/7 10:28:04 阅读次数: 我要投稿 |
|
<!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=gb2312" /> <title>图片</title> <script language="javascript"> <!-- //图片滚动列表 mengjia 070927 var Speed_1 = 10; //速度(毫秒) var Space_1 = 20; //每次移动(px) var PageWidth_1 = 116 * 7; //翻页宽度 var interval_1 = 2000; //翻页间隔 var fill_1 = 0; //整体移位 var MoveLock_1 = false; var MoveTimeObj_1; var MoveWay_1="right"; var Comp_1 = 0; var AutoPlayObj_1=null; function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}} function AutoPlay_1(){clearInterval(AutoPlayObj_1);AutoPlayObj_1=setInterval('ISL_GoDown_1();ISL_StopDown_1();',interval_1)} function ISL_GoUp_1(){if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="left";MoveTimeObj_1=setInterval('ISL_ScrUp_1();',Speed_1);} function ISL_StopUp_1(){if(MoveWay_1 == "right"){return};clearInterval(MoveTimeObj_1);if((GetObj('ISL_Cont_1').scrollLeft-fill_1)%PageWidth_1!=0){Comp_1=fill_1-(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1);CompScr_1()}else{MoveLock_1=false} AutoPlay_1()} function ISL_ScrUp_1(){if(GetObj('ISL_Cont_1').scrollLeft<=0){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft+GetObj('List1_1').offsetWidth} GetObj('ISL_Cont_1').scrollLeft-=Space_1} function ISL_GoDown_1(){clearInterval(MoveTimeObj_1);if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="right";ISL_ScrDown_1();MoveTimeObj_1=setInterval('ISL_ScrDown_1()',Speed_1)} function ISL_StopDown_1(){if(MoveWay_1 == "left"){return};clearInterval(MoveTimeObj_1);if(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1-(fill_1>=0?fill_1:fill_1+1)!=0){Comp_1=PageWidth_1-GetObj('ISL_Cont_1').scrollLeft%PageWidth_1+fill_1;CompScr_1()}else{MoveLock_1=false} AutoPlay_1()} function ISL_ScrDown_1(){if(GetObj('ISL_Cont_1').scrollLeft>=GetObj('List1_1').scrollWidth){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft-GetObj('List1_1').scrollWidth} GetObj('ISL_Cont_1').scrollLeft+=Space_1} function CompScr_1(){if(Comp_1==0){MoveLock_1=false;return} var num,TempSpeed=Speed_1,TempSpace=Space_1;if(Math.abs(Comp_1)<PageWidth_1/2){TempSpace=Math.round(Math.abs(Comp_1/Space_1));if(TempSpace<1){TempSpace=1}} if(Comp_1<0){if(Comp_1<-TempSpace){Comp_1+=TempSpace;num=TempSpace}else{num=-Comp_1;Comp_1=0} GetObj('ISL_Cont_1').scrollLeft-=num;setTimeout('CompScr_1()',TempSpeed)}else{if(Comp_1>TempSpace){Comp_1-=TempSpace;num=TempSpace}else{num=Comp_1;Comp_1=0} GetObj('ISL_Cont_1').scrollLeft+=num;setTimeout('CompScr_1()',TempSpeed)}} function picrun_ini(){ GetObj("List2_1").innerHTML=GetObj("List1_1").innerHTML; GetObj('ISL_Cont_1').scrollLeft=fill_1>=0?fill_1:GetObj('List1_1').scrollWidth-Math.abs(fill_1); GetObj("ISL_Cont_1").onmouseover=function(){clearInterval(AutoPlayObj_1)} GetObj("ISL_Cont_1").onmouseout=function(){AutoPlay_1()} AutoPlay_1(); } //产品展示滚动图片结束 //--> </script> <style type="text/css"> <!-- BODY { border-top-width: 0px; border-LEFT-width: 0px; FONT-SIZE: 12px; border-BOTTOM-width: 0px; margin: 0px; FONT-FAMILY: 宋体; background-COLOR: #fff; border-RIGHT-width: 0px } .blk_18 { border-RIGHT: #e3e3e3 1px solid; border-top: #e3e3e3 1px solid; margin-top: 8px; FONT-SIZE: 12px; background: #f3f3f3; overflow: hidden; border-LEFT: #e3e3e3 1px solid; width: 890px; border-BOTTOM: #e3e3e3 1px solid; ZOOM: 1 } .blk_18 .pcont { float: left; overflow: hidden; width: 850px } .blk_18 .ScrCont { width: 32766px; zoom: 1 } .blk_18 #List1_1 { float: left } .blk_18 #List2_1 { float: left } .blk_18 .LeftBotton { background: url(http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081201170647.gif) no-repeat; float: left; margin: 10px 1px; width: 15px; height: 72px } .blk_18 .RightBotton { background: url(http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081201170647.gif) no-repeat; float: left; margin: 10px 1px; width: 15px; height: 72px } .blk_18 .LeftBotton { background-position: 0px 0px; margin-LEFT: 5px } .blk_18 .RightBotton { background-position: 0px -100px; margin-LEFT: -1px } .blk_18 .LeftBotton:hover { background-position: -20px 0px } .blk_18 .RightBotton:hover { background-position: -20px -100px } .blk_18 .pl img { DISPLAY: block; margin: 6px auto 1px; CURSOR: pointer; border-top-STYLE: none; border-RIGHT-STYLE: none; border-LEFT-STYLE: none; border-BOTTOM-STYLE: none } .blk_18 .pl { border-RIGHT: #f3f3f3 1px solid; border-top: #f3f3f3 1px solid; float: left; border-LEFT: #f3f3f3 1px solid; width: 114px; LINE-height: 24px; border-BOTTOM: #f3f3f3 1px solid; TEXT-ALIGN: center; TEXT-DECORATION: underline } .blk_18 A.pl:hover { border-RIGHT: #ff9900 1px solid; border-top: #ff9900 1px solid; background: #fff; border-LEFT: #ff9900 1px solid; COLOR: #ff9900; border-BOTTOM: #ff9900 1px solid } .commu_cont3 { margin: 9px 7px 7px; LINE-height: 150% } .commu_cont3 ul { width: 188px } --> </style> </head> <body> <!-- picrotate_left start --> <div class="blk_18"> <a onmouseup="ISL_StopUp_1()" class="LeftBotton" onmousedown="ISL_GoUp_1()" onmouseout="ISL_StopUp_1()" href="javascript:void(0);" target="_self"></a> <div class="pcont" id="ISL_Cont_1"> <div class="ScrCont"> <div id="List1_1"> <!-- piclist begin --> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />1</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />2</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />3</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />4</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />5</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />6</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />7</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />8</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />9</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />10</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />11</a> <a class="pl" href="#"><img height="72" width="96" src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081122582644.jpg" />12</a> <!-- piclist end --> </div> <div id="List2_1"></div> </div> </div> <a onmouseup="ISL_StopDown_1()" class="RightBotton" onmousedown="ISL_GoDown_1()" onmouseout="ISL_StopDown_1()" href="javascript:void(0);" target="_self"></a> </div> <script type="text/javascript"> <!-- picrun_ini(); //--> </script> <!-- picrotate_left end --> </body> </html> |
特效说明: |
JS 图片左右滚动,图片控制左右滚动
用到的图片:
|
|
上一篇文章: 仿2010世博会主页焦点幻灯图片效果下一篇文章: 非常漂亮的JS带缩略图的幻灯图片切换 |
|
|