jQuery animate from CSS “top” to “bottom”

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

    $("#line-three").css({position:'absolute',top:'auto',bottom:'100px'})

    That should do it. You probably need to reser the 'top' value to auto

    EDIT

    To animate, you need to use .animate();

    Try this:

    $("#line-three").animate({position:'absolute',top:'auto',bottom:'100px'}, 400)

提交回复
热议问题