views:

65

answers:

2

I am not sure what I am doing wrong. The dialog box comes but it does not follow any of the settings I specified.

function voteToday(id,userid){

$(".pleaseLogin").dialog({
    autoOpen:false,
    bgiframe: true,
    resizable: false,
    width:200,
    height:75,
    modal: true,
    overlay: {
        backgroundColor: '#000',
        opacity: 0.5
    }
});

$(".pleaseLogin").dialog('open');

}
A: 

You generate two different dialogs, one doesn't open but has options, one does open but has no options.

If you give more information where you got this dialog from, I could answer how to fix it.

EDIT

I was wrong, but found out that this code works fine. The only option that doesn't seem to work is autoOpen: false, but you open the box after you give that option.

    function voteToday(id,userid){
        $(".pleaseLogin").dialog('open');
    }

    $(document).ready(function(){
        $(".pleaseLogin").dialog({
            autoOpen: false,
            bgiframe: true,
            resizable: false,
            width:500,
            height:75,
            modal: true,
            overlay: {
                backgroundColor: '#000',
                opacity: 0.5
            }
        });
        $('.something').click(voteToday);
    });
Harmen
No, he isn't generating two dialogs - at the second call he is merely opening it. Have a look at the docs for jQuery UI dialog. Some more info could help, though.
Emil Ivanov
This should work, I use this same pattern too.
Ikke
A: 

why not use the autoOpen: true setting? seems like the problem stems from calling .dialog() twice. You'll want to create the dialog when the DOM is ready, and then simply call the open method on it within your voteToday function.

DustMason