The options used when creating the dialog box can be modified by the dialog ("option", param, value) method. The param parameter is the name of the option, while the value corresponds to its new value.
lets change the effect for the opening and closing of the window. Well display two lists for which we can select the desired effect ("puff", "slide", etc.). When creating the dialog box, no effect is associated with it:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="dialog" title="Window title">
<p> Content of the dialog box</p>
</div>
Open effect
<select id="effectopen">
<option>No effect</option>
<option>blind</option>
<option>bounce</option>
<option>clip</option>
<option>drop</option>
<option>fold</option>
<option>highlight</option>
<option>puff</option>
<option>pulsate</option>
<option>scale</option>
<option>slide</option>
</select>
<br/>
Close effect
<select id="effectclose">
<option>No effect</option>
<option>blind</option>
<option>bounce</option>
<option>clip</option>
<option>drop</option>
<option>fold</option>
<option>highlight</option>
<option>puff</option>
<option>pulsate</option>
<option>scale</option>
<option>slide</option>
</select>
<br/>
<input id=open type=button value=Open>
</body>
</html>
// Java Script //
$("div#dialog").dialog ({
autoOpen : false
});
$("#effectopen").change (function (event)
{
var effect = $(this).val ();
if (effect == "No effect") effect = false;
$("div#dialog").dialog ("option", "show", effect);
});
$("#effectclose").change (function (event)
{
var effect = $(this).val ();
if (effect == "No effect") effect = false;
$("div#dialog").dialog ("option", "hide", effect);
});
$("#open").click (function (event)
{
$("#dialog").dialog ("open");
});
0 Comment(s)