Is it possible to open a jQuery UI Dialog without a title bar?
Is it possible to open a jQuery UI Dialog without a title bar?
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.
I figured out a fix for dynamically removing the title bar.
$("#example").dialog(dialogOpts);
// remove the title bar
$(".ui-dialog-titlebar").hide();
This will remove all elements with the class 'ui-dialog-titlebar' after the dialog box is rendered.
I believe you can hide it with CSS:
.ui-dialog-titlebar {
display: none;
}
Alternatively, you can apply this to specific dialogs with the dialogClass option:
$( "#createUserDialog" ).dialog({
dialogClass: "no-titlebar"
});
.no-titlebar .ui-dialog-titlebar {
display: none;
}
Check out "Theming" the Dialog. The above suggestion makes use of the dialogClass option, which appears to be on it's way out in favor of a new method.
Have you tried solution from jQuery UI docs? https://api.jqueryui.com/dialog/#method-open
As it say you can do like this...
In CSS:
.no-titlebar .ui-dialog-titlebar {
display: none;
}
In JS:
$( "#dialog" ).dialog({
dialogClass: "no-titlebar"
});
This worked for me
open: function(event, ui) {
$(".ui-dialog-titlebar", $(this).parent())
.hide();
Full
$speedbump.dialog({
dialogClass: 'speedbump-container',
autoOpen: false,
closeOnEscape: false,
modal: true,
resizable: false,
draggable: false,
create: function () {
$speedbump
.closest('.ui-dialog')
.attr('id', 'speedbump-container');
},
open: function(event, ui) {
$(".ui-dialog-titlebar", $(this).parent())
.hide();
}