JQuery with css3 keydown keyCode = 37 and 39
        Posted  
        
            by 
                rayrule
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by rayrule
        
        
        
        Published on 2011-11-29T00:29:31Z
        Indexed on 
            2011/11/29
            1:49 UTC
        
        
        Read the original article
        Hit count: 282
        
I have tested both ways. jquery animation and css3 transition, and css3 is a little bit faster. But i have a problem with the following code:
 $(document).keydown(function(e){
if (e.keyCode == 39) { 
    var DocHeight = $(document).height();
    $('.container').css("margin-top","-="+DocHeight)
}
});
if i hit twice on keyCode 39 (arrow to the right) than my transition is outer space. Does anyone has an solution for this thing?
outer space
maybe not the correct word. But the problem is. if i hit twice the arrow key i'll get the last request, in other words... animation is started, and another animation start from the position that i don't want.
example: hit #1 margin-top is at 0px and goes to 1024px. but when i hit it twice the margin-top is at 23px, and it stops at 1047px.
This is not what i want. It has to stop at 1024px.
I hope so.
© Stack Overflow or respective owner