jQuery animate from CSS “top” to “bottom”

后端 未结 9 1877
北海茫月
北海茫月 2021-01-04 06:49

I\'m looking to animate a div element from an absolute top position to an absolute bottom position on the page load.

The combination of CSS and jQuery code below fai

9条回答
  •  一向
    一向 (楼主)
    2021-01-04 07:33

    EDIT: had to leave quickly so didn't get to finish, I decided to use jquery ui for the example (you need core):

    
    
    
    
    
    
    
    hello;

    http://jsfiddle.net/syVzK/1/ (changed toggle switch to prevent over animation)

    I like some other suggestions as well.

    EDIT2: Just tested in IE... it works oddly. Maybe have to do straight because of odd behavior in IE with Jquery UI switch class.

    EDIT3:

    Ok, I got this working for IE and FF... Some notes though. The +20 is to keep it from jumping. The test for innerHeight of 0 is in case height isn't set for the element (or body), so if it's in an div that's positioned, then set height.

    Also, this did not work in jsfiddle, but worked on a regular webpage. Avoid, jsfiddle for this.

        
    

提交回复
热议问题