Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.55 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Continuous element movement with jQuery
  2. if (e.keyCode === 39 && (p1_left < 784)) {
  3.     $('#p1').rotate(0);
  4.     setInterval ( function() {
  5.         $('#p1').animate( { left:  "+=16px", }, 50); }, 50);
  6. }
  7.        
  8. while (p1_left <= 784) {
  9.     pl_left+=16;
  10.     $('#p1').css('left', p1_left);
  11. }
  12.        
  13. function moveLeft(theID){
  14.     $(theIE).animate({...},1000, function(){
  15.        if(/* keep moving */){
  16.            move_left(theID);
  17.        }
  18.     }
  19. }
  20.        
  21. var $p1 = $('#p1');
  22. if (e.keyCode === 39 && (p1_left < 784)) {
  23.   $p1.rotate(0);
  24.   $p1.animate({ 'left' : 784 });
  25. }