Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ minimal chrome.
$.popupWindow('http://www.google.com', { height: 300, width: 200 });
```

### Simple Example with Object as Parameter

Another option is to call `popupWindow` with a single object that contains a url
key and any other settings. This is functionally the same as the above example
and is only a stylistic difference.

```
$.popupWindow({ url: 'http://www.google.com', height: 300, width: 200 });
```

### More Examples

There are more [examples] to look at as well.
Expand Down
9 changes: 9 additions & 0 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
}
});
});

$('.example-objectapi').on('click', function(event) {
event.preventDefault();
$.popupWindow({
url: 'http://google.com'
});
});

})
</script>
</head>
Expand All @@ -41,6 +49,7 @@ <h2>Examples</h2>
<li><a href="#" class="example-defaults">Open window (with defaults)</a></li>
<li><a href="#" class="example-small">Open window (custom size: 200x200)</a></li>
<li><a href="#" class="example-callback">Open window (close callback)</a></li>
<li><a href="#" class="example-objectapi">Object API</a></li>
</ul>

<h2>More Details</h2>
Expand Down
7 changes: 6 additions & 1 deletion jquery.popupwindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
status: false,
toolbar: false,
top: 0,
width: 500
width: 500,
url: ""
};

$.popupWindow = function(url, opts) {
if ($.isPlainObject(url)) {
opts = url;
url = opts.url;
}
var options = $.extend({}, defaults, opts);

// center the window
Expand Down