Steven
Steven

Reputation: 19425

Why is .show() not fired after .slideUp()?

I'm gracefully trying to close a file list div after upload.

uploader.bind('UploadComplete', function(up, files) {
    jQuery('#filelist').delay(500).slideUp('slow').promise().done(function(){
        jQuery('#filelist .file_name').remove();
    }).show();
});

.slideUp() adds the style style="display: none;" to my div. I'm trying to remove this by calling .show() after .slideUp() has fired. But it seems a) I don't quite understnd how jQuery works and b) placed the .show() in the wrong place.

Can anyone tell me how I can solve this issue? Thanks :)

Upvotes: 1

Views: 62

Answers (1)

Roko C. Buljan
Roko C. Buljan

Reputation: 206008

Just an example let's say you have a display:none; element .hidden:

$('.hidden').fadeTo(3000, 1).hide(); // will never fade
$('.hidden').hide().fadeTo(3000, 1); // will fade !

uploader.bind('UploadComplete', function(up, files) {
    jQuery('#filelist').delay(500).slideUp('slow').promise().done(function(){
        jQuery('#filelist .file_name').remove();
        jQuery('#filelist').show(); // PUT INSIDE CALLBACK
    });
});

Upvotes: 2

Related Questions