Thread: Problem!!!
View Single Post
  #5 (permalink)  
Old 05-09-08, 01:59 AM
Vicious's Avatar
Vicious Vicious is offline
Community VIP
 
Join Date: Jan 2007
Location: Belgium
Posts: 584
Thanks: 0
Thanked 0 Times in 0 Posts
Since you're asking so nicely... not
javascript Code:
  1. var timerMove = null;
  2.  
  3. function moveDown(){
  4.     var items = document.getElementById("my_sliding_div");
  5.    
  6.     if (timerMove == null){
  7.         timerMove = window.setInterval(function(){
  8.             doMoveVertical(30,1,0,items);
  9.         },5);
  10.     }
  11. }
  12.  
  13. function moveUp(){
  14.     var items = document.getElementById("my_sliding_div");
  15.    
  16.     if (timerMove == null){
  17.         timerMove = window.setInterval(function(){
  18.             doMoveVertical(30,-1,-480,items);
  19.         },5);
  20.     }
  21. }
  22.  
  23. function doMoveVertical(step,sign,limit,items){
  24.     var curTop = items.style.top.replace("px","")*1;
  25.     if ((sign > 0 && (curTop < limit)) || (sign < 0 && (Math.abs(curTop) < Math.abs(limit)))){
  26.         items.style.top = (curTop + (sign*step)) + "px";
  27.     } else {
  28.         // stop moving:
  29.         window.clearInterval(timerMove);
  30.         timerMove = null;
  31.     }
  32. }

Don't expect support; I'm only giving this script because I had it right in front of me. Next time do us a favor, and either post in the script requests section, or show us you did an effort.
__________________
Jack Bauer makes Chuck Norris cry
Reply With Quote