Maybe try making the dialog autoOpen: false and then only open it
after checking the cookie:


        <script type="text/javascript">

        $(function() {
                $("#dialog")
                .dialog({
                        bgiframe: true,
                        modal: true,
                        resizable: false,
                        autoOpen: false,
                        width:200,
                        close: function() {
                                $.cookie('doneDi', 'closed',
{ expires: 2 })
                                },
                        buttons: {
                                Ok: function() {
                                        $(this).dialog('close')
                                        $.cookie('doneDi', 'closed',
{ expires: 2 });
                                }
                        }

                        });

                var doneDi = $.cookie('doneDi');

         if (doneDi != 'closed') {
       $("#dialog").dialog( 'open') ;

         };
        });

        </script>


Hth,

Dave

On Nov 2, 11:48 am, stefpretty <[email protected]> wrote:
> Hey guys, just pasting my code here; i'm trying ot make it so the
> dialog comes up and then when 'x' or close is clicked it creates a
> cookie which expires in say 2 days and so the dialog wont launch once
> the cookie is created.
>
> I am using the cookie.jquery.js plugin, so heres the code!
>
>         <script type="text/javascript">
>
>         $(function() {
>                 $("#dialog")
>                 .dialog({
>                         bgiframe: true,
>                         modal: true,
>                         resizable: false,
>                         autoOpen: true,
>                         width:200,
>                         close: function() {
>                                 $.cookie('doneDi', 'closed', { expires: 2 })
>                                 },
>                         buttons: {
>                                 Ok: function() {
>                                         $(this).dialog('close')
>                                         $.cookie('doneDi', 'closed', { 
> expires: 2 });
>                                 }
>                         }
>
>                         });
>
>                 var doneDi = $.cookie('doneDi');
>
>          if (doneDi == 'closed') {
>        $("#dialog").dialog( 'disable') ;
>
>          };
>         });
>
>         </script>
>
> Cheers in advance, it's been driving me nuts!!
>
> Stefpretty

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to