Is it possible to open a jQuery UI Dialog without a title bar?
If you have multiple dialog, you can use this:
$("#the_dialog").dialog({
open: function(event, ui) {
//hide titlebar.
$(this).parent().children('.ui-dialog-titlebar').hide();
}
});
For me, I still wanted to use the re-sizable corners, just didn't want so see the diagonal lines. I used
$(".ui-resizable-handle").css("opacity","0");
Just realized I was commenting on the wrong question. Living up to my namesake :(
You could remove the bar with the close icon with the techinques described above and then add a close icon yourself.
CSS:
.CloseButton {
background: url('../icons/close-button.png');
width:15px;
height:15px;
border: 0px solid white;
top:0;
right:0;
position:absolute;
cursor: pointer;
z-index:999;
}
HTML:
var closeDiv = document.createElement("div");
closeDiv.className = "CloseButton";
//append this div to the div holding your content
JS:
$(closeDiv).click(function () {
$("yourDialogContent").dialog('close');
});
Try using
$("#mydialog").closest(".ui-dialog-titlebar").hide();
This will hide all dialogs titles
$(".ui-dialog-titlebar").hide();
I think that the best solution is to use the option dialogClass
.
An extract from jquery UI docs:
during init : $('.selector').dialog({ dialogClass: 'noTitleStuff' });
or if you want after init. :
$('.selector').dialog('option', 'dialogClass', 'noTitleStuff');
So i created some dialog with option dialogClass='noTitleStuff' and the css like that:
.noTitleStuff .ui-dialog-titlebar {display:none}
too simple !! but i took 1 day to think why my previous id->class drilling method was not working. In fact when you call .dialog()
method the div you transform become a child of another div (the real dialog div) and possibly a 'brother' of the titlebar
div, so it's very difficult to try finding the latter starting from former.