开发者

Popup windows sizes

I want to create a popup that will have a defined size like the BBC did. 开发者_Go百科As you can see, when you click "Listen Live", they open a popup player, but I didn't understand how they did that.

Any chance for explanation?

Sorry, newbie in JavaScript


Try using this function:

    openChildWindowWithDimensions = function(url, width, height, showMenu, canResize, showScrollbars) {
        var childWindow = window.open(url, "", "\"width=" + width + ",height=" + height + ",menubar=" + (showMenu ? "1" : "0") + ",scrollbars=" + (showScrollbars ? "1" : "0") + ",resizable=" + (canResize ? "1" : "0") + "\"");
        if (childWindow){
            childWindow.resizeTo(width, height);
        }
    }

I added the logic to resize the window because of a bug in IE9. Depending on what browser you're using, you may not need that bit.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜