开发者

What do these jQuery statements mean or what do they do?

开发者 https://www.devze.com 2023-02-24 10:49 出处:网络
What exactly does the below jQuery statements mean or what do they do? $(window).focus(ma开发者_C百科inWindowFocus);

What exactly does the below jQuery statements mean or what do they do?

$(window).focus(ma开发者_C百科inWindowFocus);
$(window).unbind('focus', mainWindowFocus);

This is in relation to main window and a child/popup window.

function mainWindowFocus() {
    if (popUpWindow && !popUpWindow.closed) {
        popUpWindow.focus();
    } else {
         popUpWasClosed();
    }
}


$(window).focus(mainWindowFocus);

This statement will bind the focus event to the window and attaches the function mainWindowFocus as event handler.

$(window).unbind('focus',mainWindowFocus);

This statement will explicitly remove the function mainWindowFocus from the event handlers for the focus event, which are bound to the window.

0

精彩评论

暂无评论...
验证码 换一张
取 消