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

前端 未结 5 1893
孤城傲影
孤城傲影 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:00

    I believe you're looking for an effect more like 'blind':

    $('#drawer').show('blind');
    

    It's odd that $.fn.slideDown() and $.fn.show('slide') don't operate the same way, but rather 'blind' does. 'slide' creates a placeholder the size of your object and then slides into the frame of view, while blind adjusts the height or width of your element until it expands to the correct size (while overflow is set to hidden). So actually, the effect names are correct, but there's some confusion because of the legacy name $.fn.slideDown().

提交回复
热议问题