Skip to content

Instantly share code, notes, and snippets.

@SamWM
Created December 30, 2009 16:43
Show Gist options
  • Save SamWM/266169 to your computer and use it in GitHub Desktop.
Save SamWM/266169 to your computer and use it in GitHub Desktop.
jQuery UI Dialog iframe
$("a.dialog").click(
function(e) {
e.preventDefault();
var title = this.title;
if (!title.length) title = $(this).text();
// create a dialog box and set the iframe to the linked page
var dialog = $("<div><iframe /></div>")
.find("iframe").attr({ "frameBorder": 0, "width": "100%", "height": "100%", "scrolling": "auto", "src": this.href }).end()
.dialog(
{
title: title,
modal: true,
height: 500,
width: 650,
close: dialogClose
}
).find(".ui-dialog-content").css("padding", 0).end();
}
);
function dialogClose(event, ui) { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment