If the content length exceeds the maximum height, a scrollbar will automatically appear.
A bottom button bar and semi-transparent modal overlay layer are common options that can be added.$("#dialog").dialog();
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="http://ui.jquery.com/testing/themes/base/ui.all.css" />
<script type="text/javascript" src="http://ui.jquery.com/testing/jquery-1.3.1.js"></script>
<script type="text/javascript" src="http://ui.jquery.com/testing/ui/ui.core.js"></script>
<script type="text/javascript" src="http://ui.jquery.com/testing/ui/ui.draggable.js"></script>
<script type="text/javascript" src="http://ui.jquery.com/testing/ui/ui.resizable.js"></script>
<script type="text/javascript" src="http://ui.jquery.com/testing/ui/ui.dialog.js"></script>
<script>
$(document).ready(function(){
$("#dialog").dialog();
});
</script>
</head>
<body style="font-size:62.5%;">
<div id="dialog" title="Dialog Title">I'm in a dialog</div>
</body>
</html>
This event is triggered when dialog is opened.
Supply a callback function to handle the open event as an init option.
$('.selector').dialog({
open: function(event, ui) { ... }
});
Bind to the open event by type: dialogopen.
$('.selector').bind('dialogopen', function(event, ui) {
...
});
This event is triggered when the dialog gains focus.
Supply a callback function to handle the focus event as an init option.
$('.selector').dialog({
focus: function(event, ui) { ... }
});
Bind to the focus event by type: dialogfocus.
$('.selector').bind('dialogfocus', function(event, ui) {
...
});
This event is triggered at the beginning of the dialog being dragged.
Supply a callback function to handle the dragStart event as an init option.
$('.selector').dialog({
dragStart: function(event, ui) { ... }
});
Bind to the dragStart event by type: dragStart.
$('.selector').bind('dragStart', function(event, ui) {
...
});
This event is triggered when the dialog is dragged.
Supply a callback function to handle the drag event as an init option.
$('.selector').dialog({
drag: function(event, ui) { ... }
});
Bind to the drag event by type: drag.
$('.selector').bind('drag', function(event, ui) {
...
});
This event is triggered after the dialog has been dragged.
Supply a callback function to handle the dragStop event as an init option.
$('.selector').dialog({
dragStop: function(event, ui) { ... }
});
Bind to the dragStop event by type: dragStop.
$('.selector').bind('dragStop', function(event, ui) {
...
});
This event is triggered at the beginning of the dialog being resized.
Supply a callback function to handle the resizeStart event as an init option.
$('.selector').dialog({
resizeStart: function(event, ui) { ... }
});
Bind to the resizeStart event by type: resizeStart.
$('.selector').bind('resizeStart', function(event, ui) {
...
});
This event is triggered when the dialog is resized.
Supply a callback function to handle the resize event as an init option.
$('.selector').dialog({
resize: function(event, ui) { ... }
});
Bind to the resize event by type: resize.
$('.selector').bind('resize', function(event, ui) {
...
});
This event is triggered after the dialog has been resized.
Supply a callback function to handle the resizeStop event as an init option.
$('.selector').dialog({
resizeStop: function(event, ui) { ... }
});
Bind to the resizeStop event by type: resizeStop.
$('.selector').bind('resizeStop', function(event, ui) {
...
});
This event is triggered when the dialog is closed.
Supply a callback function to handle the close event as an init option.
$('.selector').dialog({
close: function(event, ui) { ... }
});
Bind to the close event by type: dialogclose.
$('.selector').bind('dialogclose', function(event, ui) {
...
});
Remove the dialog functionality completely. This will return the element back to its pre-init state.
Disable the dialog.
Enable the dialog.
Get or set any dialog option. If no value is specified, will act as a getter.
Close the dialog.
Returns true if the dialog is currently open.
Move the dialog to the top of the dialogs stack.
Open the dialog.
The jQuery UI Dialog plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain.
If a deeper level of customization is needed, there are widget-specific classes referenced within the ui.dialog.css stylesheet that can be modified. These classes are highlighed in bold below.
Note: This is a sample of markup generated by the dialog plugin, not markup you should use to create a dialog. The only markup needed for that is <div></div>.