开发者

Popup windows sizes

开发者 https://www.devze.com 2023-03-27 07:27 出处:网络
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 th

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

精彩评论

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