Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery: Can I use a Dialog to open up an external web page?

Can I use a JQuery Dialog to open up an external web page, and if so - how?

Essentially, I want to replicate the abilities of LightWindow using JQuery (LightWindow is based on scriptalous).

www.stickmanlabs.com/lightwindow/index.html

Ideally, I want to use something that is apart of the JQuery core. If it need to be a JQuery plug-in, that's fine but I would really like to have it be apart of the core functionality of such features already exist.

like image 613
TeddyB Avatar asked Jan 06 '10 19:01

TeddyB


1 Answers

In JQueryUI you are using a DIV as a Dialog.

$(function() {
  $("#dialog").dialog();
});

So you can use an iframe inside DIV:

<div id="dialog" title="Google">
    <IFRAME style="border: 0px;" SRC="http://www.google.com" width="100%" height = "100%" >
</div>

Edit:

If you want every LINK in your page to be displayed on JQueryUI Dialog here it is:

JavaScript:

$("a").click(function(event){
  event.preventDefault();
  $("#frame").attr("src", $(this).attr("href"));
  $('#dialog').dialog('open');
});

HTML:

<div id="dialog" title="Dialog Title">
    <IFRAME id="frame" style="border: 0px;" SRC="" width="100%" height = "100%" >
</div>
like image 192
JCasso Avatar answered Nov 19 '22 14:11

JCasso