开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜