
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.55 KB | hits: 11 | expires: Never
Continuous element movement with jQuery
if (e.keyCode === 39 && (p1_left < 784)) {
$('#p1').rotate(0);
setInterval ( function() {
$('#p1').animate( { left: "+=16px", }, 50); }, 50);
}
while (p1_left <= 784) {
pl_left+=16;
$('#p1').css('left', p1_left);
}
function moveLeft(theID){
$(theIE).animate({...},1000, function(){
if(/* keep moving */){
move_left(theID);
}
}
}
var $p1 = $('#p1');
if (e.keyCode === 39 && (p1_left < 784)) {
$p1.rotate(0);
$p1.animate({ 'left' : 784 });
}