-
Notifications
You must be signed in to change notification settings - Fork 551
Expand file tree
/
Copy pathjquery.dialogIframe.js
More file actions
42 lines (39 loc) · 1.05 KB
/
jquery.dialogIframe.js
File metadata and controls
42 lines (39 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
*
* Copyright (c) 2010 Sam Collett (http://www.texotela.co.uk)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version 1.0
*
*/
;(function($) {
/*
* Shows a web page (using iframe) in a jQuery UI Dialog box.
*
*/
$.fn.dialogIframe = function(options)
{
options = $.extend({}, $.fn.dialogIframe.defaults, options);
$(this).click(
function(e) {
var el = this;
e.preventDefault();
var title = el.title;
if (!title.length) title = $(el).text();
// create a dialog box and set the iframe to the linked page
var dialog = $("<div id='iframedialog'><iframe /></div>")
.find("iframe").attr({ "frameBorder": 0, "width": "100%", "height": "100%", "scrolling": "auto", "src": el.href }).end()
.dialog(
{
title: title,
height: options.height,
width: options.width
}
).find(".ui-dialog-content").css("padding", 0).end();
});
}
$.fn.dialogIframe.defaults = {
width: 500, height: 400
};
})(jQuery);