hotStore.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!--//--><![CDATA[//><!--
  2. //图片滚动列表 mengjia 070816
  3. var Speed = 10; //速度(毫秒)
  4. var Space = 10; //每次移动(px)
  5. var PageWidth = 182; //翻页宽度
  6. var fill = 0; //整体移位
  7. var MoveLock = false;
  8. var MoveTimeObj;
  9. var Comp = 0;
  10. var AutoPlayObj = null;
  11. GetObj("List2").innerHTML = GetObj("List1").innerHTML;
  12. GetObj('ISL_Cont').scrollLeft = fill;
  13. GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);}
  14. GetObj("ISL_Cont").onmouseout = function(){AutoPlay();}
  15. AutoPlay();
  16. function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval
  17. ('document.all.'+objName)}}
  18. function AutoPlay(){ //自动滚动
  19. clearInterval(AutoPlayObj);
  20. AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',6000); //间隔时间
  21. }
  22. function ISL_GoUp(){ //上翻开始
  23. if(MoveLock) return;
  24. clearInterval(AutoPlayObj);
  25. MoveLock = true;
  26. MoveTimeObj = setInterval('ISL_ScrUp();',Speed);
  27. }
  28. function ISL_StopUp(){ //上翻停止
  29. clearInterval(MoveTimeObj);
  30. if(GetObj('ISL_Cont').scrollLeft % PageWidth-fill != 0){
  31. Comp = fill-(GetObj('ISL_Cont').scrollLeft % PageWidth);
  32. CompScr();
  33. }else{
  34. MoveLock = false;
  35. }
  36. AutoPlay();
  37. }
  38. function ISL_ScrUp(){ //上翻动作
  39. if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj
  40. ('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth}
  41. GetObj('ISL_Cont').scrollLeft -= Space ;
  42. }
  43. function ISL_GoDown(){ //下翻
  44. clearInterval(MoveTimeObj);
  45. if(MoveLock) return;
  46. clearInterval(AutoPlayObj);
  47. MoveLock = true;
  48. ISL_ScrDown();
  49. MoveTimeObj = setInterval('ISL_ScrDown()',Speed);
  50. }
  51. function ISL_StopDown(){ //下翻停止
  52. clearInterval(MoveTimeObj);
  53. if(GetObj('ISL_Cont').scrollLeft % PageWidth-fill != 0 ){
  54. Comp = PageWidth-GetObj('ISL_Cont').scrollLeft % PageWidth + fill;
  55. CompScr();
  56. }else{
  57. MoveLock = false;
  58. }
  59. AutoPlay();
  60. }
  61. function ISL_ScrDown(){ //下翻动作
  62. if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft =
  63. GetObj('ISL_Cont').scrollLeft-GetObj('List1').scrollWidth;}
  64. GetObj('ISL_Cont').scrollLeft += Space ;
  65. }
  66. function CompScr(){
  67. var num;
  68. if(Comp == 0){MoveLock = false;return;}
  69. if(Comp < 0){ //上翻
  70. if(Comp < -Space){
  71. Comp += Space;
  72. num = Space;
  73. }else{
  74. num = -Comp;
  75. Comp = 0;
  76. }
  77. GetObj('ISL_Cont').scrollLeft -= num;
  78. setTimeout('CompScr()',Speed);
  79. }else{ //下翻
  80. if(Comp > Space){
  81. Comp -= Space;
  82. num = Space;
  83. }else{
  84. num = Comp;
  85. Comp = 0;
  86. }
  87. GetObj('ISL_Cont').scrollLeft += num;
  88. setTimeout('CompScr()',Speed);
  89. }
  90. }
  91. //--><!]]>