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

前端 未结 5 1889
孤城傲影
孤城傲影 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 13:39

    Yes it is like the accordion behavior except that you can also slide it up. I have used this functionality to create what I think you are looking for.

    $('#drawer').slideDown('slow');

    By changing the speed you can get different slide speeds to look the way you want it. Now, even though you have the drawer element, you need a container that is initially hidden which is what will slide. Lets say you have a button with an id of "drawer", and a container with an id of "myDrawerContent." You would do the following,

    $('#drawer').click(function() {
        $('#myDrawerContent').slideDown('slow');
    }
    
    $('#drw_loader').animate({ 
        height: $('#drw_ajax').height() }, 
        function () { $('#drw_loader').fadeOut(function () { $('#drw_ajax').fadeIn(); });
    }); 
    

    Hope this helps.

    Metropolis

提交回复
热议问题