I have some code that shows a div with a message in it when button is clicked. I want the div to disappear after a few seconds.
I have tried to achieve this adding $(this).delay().hide(500); in the .notify function but it doesn't work.       
$.fn.notify = function(settings_overwrite) {
    settings = {
        placement: "top",
        default_class: ".message",
        delay: 0
    };
    $.extend(settings, settings_overwrite);
    $(settings.default_class).each(function() { $(this).hide(); });
    $(this).show().css(settings.placement, -$(this).outerHeight());
    obj = $(this);
    if (settings.placement == "bottom") {
        setTimeout(function() { obj.animate({ bottom: "0" }, 500) }, settings.delay);
    }
    else {
        setTimeout(function() { obj.animate({ top: "0" }, 500) }, settings.delay);      
    }
}
/** begin notification alerts
-------------------------------------**/
$(document).ready(function($) {
    $('.message').on('click', (function() {
        $(this).fadeTo('slow', 0, function() {
            $(this).slideUp("slow", function() {
                $(this).remove();
            });
        });
    }));
});
$(document).ready(function() {
    if (document.location.href.indexOf('#notify_success') > -1) {
        $("#notify_autopop").notify({
            delay: 500
        });
    }
});