Skip to content

Instantly share code, notes, and snippets.

@scottsappen
Created July 1, 2013 15:17
Show Gist options
  • Save scottsappen/5901745 to your computer and use it in GitHub Desktop.
Save scottsappen/5901745 to your computer and use it in GitHub Desktop.
Sometimes you just want a simple modal dialog box that works in most browsers without too much to do about it. Jquery makes it so easy.
1. Identify a div tag that contains the content you want to popup and display.
In this case, we have a div tag called dialog_betamode.
We also have an element called floating_betamode that we will click to launch the dialog.
2. Put this in your initialization area
$(function () {
var dlg = $("#dialog_betamode").dialog({
autoOpen: false,
show: "blind",
modal: true,
resizable: false
});
});
$("#floating_betamode").click(function () {
$("#dialog_betamode").dialog("open");
return false;
});
3. Take out modal:true if you want the user to be able to do other things while it’s displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment