jQuery slideDown vs. jQuery UI .show('slide')

前端 未结 5 1894
孤城傲影
孤城傲影 2021-02-03 13:07

I\'m trying to utilize jQuery\'s built in effect functionality to create a \"drawer\" that slides out from behind a navigation bar, pushing the content below it out of the way.<

5条回答
  •  天涯浪人
    2021-02-03 14:01

    The javascript you have in your question update works, but it needs to operate on an element containing your content rather than the content itself.

    To see this in action, surround the element #drawer with another div:

    ...

    And animate the container:

    $('#container')
        .css({ marginTop: $('#container').height() * -1 })
        .animate({ marginTop: 0 });
    

提交回复
热议问题