jQuery animate from CSS “top” to “bottom”

后端 未结 9 1923
北海茫月
北海茫月 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:24

    Maybe this would help?

    $(document).ready( function() {
        var div = jQuery("#dvVertigo");
    
        div.animate({
               left: '0',    
                    top: '+=' + ($(window).height()-20)               
                }, 5000, function () {
                    // Animation complete.
                });
    });
    

    Full code:

    http://jsfiddle.net/yyankowski/jMjdR/

提交回复
热议问题