zudolab jqPopWin

About

jqPopWin implements simple popup window management.
works as jQuery plugin.

Author

Takeshi Takatsudo [website] [mail]

How to use

Simple usage

  1. Load jQuery and "jqPopWin.js"
  2. Specify the window.open setting like following.
    You can associate the window.open setting with specified anchor elements.

    new jqPopWin({
        selector: "a.popWin1",
        style: [
            ["width", 300],
            ["height", 300]
        ]
    });

    This means that all anchors with class="popWin1" will open the URL by window.open.
    And the windows' width and height will be 300px.

window.open options

You can specify the window.open options like following code.

new jqPopWin({
    selector: "a.popWin3",
    name: "popup",
    focusWin: false,
    resizeWin: true,
    style: [
        ["width", 500],
        ["height", 500],
        ["directories", "yes"],
        ["location", "yes"],
        ["menubar", "yes"],
        ["resizable", "yes"],
        ["scrollbars", "yes"],
        ["status", "yes"],
        ["toolbar", "yes"],
        ["fullscreen", "no"]
    ]
});

Following table is the list of options.

name Specify the window.name.
If you don't specify this value, popup will be opened without window.name.
focusWin Specify true or false.
You can choose to try to focus popup window after window.open. Default value is true.
note: Many browsers ignore window focusing recently. Please check the browser's option setting if you doubt that this doesn't work. And only the pages in the same domain can be focused because the windows whose URL is different from the original window cannnot be controled because of security problem.
resizeWin Specify true or false.
You can choose to resize popup window or not after window.open. Default value is false.
You may need to choose true if you specify the window.name and many popups with different size are opened.
style Specify the window.open options as array.
See the browser's dev document about window.open style.

How to specify widht/height, window.name directly

You can specify window.name directly.
Following code is the example.
The window.name of the opened window will be "anotherWindowName".

<a href="dummy.html" class="popWin1" target="anotherWindowName">window name specified</a>

The window.name of the opened window will be the value specified as the target attribute even if the "name" option was specified as jqPopWin's option. Direct specified window.name will be respected.
This will be applied only to the window opened by this anchor element.

You can specify the width,height style option directly too.
Following code is the example.
The width and height of the opened window will be "700px".

<a href="dummy.html" class="popWin1 w_700_h_700">window name specified</a>

The width/height of the opened window will be the value specified as the 2nd class attribute even if the width/height was specified by jqPopWin's option. Direct specified width/height value will be respected.
This will be applied only to the window opened by this anchor element.

See the example to check the result.

Target browsers

  • Internet Explorer 6+
  • Firefox 2+
  • Safari 2.0.4+
  • Opera 9.6+

Please tell me if you found that this script does not work on your browser though I cannnot support old browsers. takazudo@gmail.com

Depend on

I checked this script with jQuery version1.2.6.
Please tell me if this script doesn't work in newer version of jQuery.

License

You can use this script for your personal or commercial use if you don't erase the credit in the script.

ChangeLog

date version notes
2009/1/5 1 first release.

FAQ

No question is asked yet.
Please report me if you found some bugs. takazudo@gmail.com