I have div(box) on my page and I'm using this script to display div as dialog box. Inside that div I have a hyper link, On click of the hyper link I want to fade out the dialog box and close.. The content of the dialog fades out, but the border of the dialog box remains same. If I add $("#box").dialog('close') to the click function after fadeto there is no effect.. it just closes the dialog box completely. Any help? using jquery-ui-1.7.2
<script type="text/javascript">
$(document).ready(function(){
$("a#later").click(function () {
$("#box").fadeTo('slow', 0);
})
});
$(function () {
$("#box").dialog({
autoOpen: true,
width: 500,
modal: true,
});
});
</script>
How about
$("#box").fadeTo('slow', 0, function() {
$("#box").dialog('close');
});
You want the close to happen after the fade finishes, correct?
try this, it might work:
$("a#later").click(function () {
$("#box").fadeTo('slow', function() {
$("#box").dialog("close")
});
});
I try the code of some Richard below and it works. You can provide the effect name as a string:
$("#dialog").dialog({
hide: "fadeOut"
});
or you can provide a hash if you have additional options, such as:
$("#dialog").dialog({
hide: {effect: "fadeOut", duration: 5000}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With