diff --git a/keyboardanimation/jscss/Kjs.js b/keyboardanimation/jscss/Kjs.js index 49287ec..7a72f7f 100644 --- a/keyboardanimation/jscss/Kjs.js +++ b/keyboardanimation/jscss/Kjs.js @@ -151,30 +151,19 @@ $( "body" ).keydown(function(event) { $("#"+id).css("width","20%"); -if(Math.floor(Math.random()*100)%2){ - $(".animation").animate({ - opacity: 0.15, - bottom: "+="+heightofwindow, - left: "+="+ (Math.floor(Math.random() * (500 - 100)) + 100), - }, +var animateObj = { + opacity: 0.15, + bottom: "+="+heightofwindow, + marginLeft : Math.floor(Math.random() * (windowWidth-100))+"px" + }; + + $(".animation").animate( + animateObj, 2000, function() { $(this).remove(); }); -}else{ - - $(".animation").animate({ - opacity: 0.15, - bottom: "+="+heightofwindow, - right: "+="+ (Math.floor(Math.random() * (windowWidth/2 - 100)) + 100), - }, - 2000, - function() { - $(this).remove(); - }); - -} id++;