Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Tools: How to close an overlay?

$("a[rel]").getOverlay().close();
$("a[rel]").close();

Both don't work.

$(document).ready(function () {
        $("a[rel]").overlay({
            mask: '#3B5872',
            effect: 'apple',
            onBeforeLoad: function () {
                var wrap = this.getOverlay().find(".contentWrap");
                wrap.load(this.getTrigger().attr("href"));
            },
            onLoad: function () {
                $('.contentWrap form').submit(function (event) {
                    event.preventDefault();
                    $("a[rel]").overlay().close();
                    hijack(this, update_employees, "html");
                });
            }
        });
    });

    function hijack(form, callback, format) {
        $.ajax({
            url: form.action,
            type: form.method,
            dataType: format,
            data: $(form).serialize(),
            success: callback
        });
    }

    function update_employees(result) {
        $("#gridcontainer").html(result);
    }

Any suggestions?

I use Chrome because the onLoad event seems not work correctly in FF.

like image 753
Rookian Avatar asked Jul 16 '10 16:07

Rookian


1 Answers

Like this:

$("a[rel]").overlay().close();

For most of their scripting you call the original method, e.g. .overlay() then call the method you want on that object.

like image 166
Nick Craver Avatar answered Oct 20 '22 15:10

Nick Craver