Hide Title bar and Show Close Button in jQuery Dialog
Asked Answered
K

5

2

I have hide title bar in jQuery Dialog as below

$(".ui-dialog-titlebar").hide();

This also hide close button in Dialog. But i need to show close button on Dialog.

How can i do this ?

Karyosome answered 16/7, 2013 at 9:11 Comment(5)
@seemly tried this $(".ui-dialog-titlebar-close").show();Karyosome
Try like this: $(".ui-dialog-titlebar-close").css('visibility', 'visible');Gainly
@PriyaSunanthan not workedKaryosome
can u fiddle ur code.Gainly
@PriyaSunanthan jsfiddle.net/62yJ4Karyosome
D
7

Adding the following CSS will hide the title text and style, leaving the close button in place - see demo.

.ui-dialog-title {
    display:none;
}

.ui-dialog-titlebar {
    background:transparent;
    border:none;
}

.ui-dialog .ui-dialog-titlebar-close {
    right:0;
}

However, if you want to change the style of the close button itself (as mentioned in your other question - Arrow in Bottom of jQuery Dialog) then I suggest asking another question since showing the closeText is still a problem when using a jQuery theme - see jQuery UI Dialog - Cannot see the closeText

Duffie answered 16/7, 2013 at 10:55 Comment(4)
I have added this code. but close button is display in left side. not in right side.Karyosome
Do you have an example of your code where this is happening? It is on the right side in my demo.Duffie
Created Demo with my code. It is working properly. but in my pc, close button is display in left side.Karyosome
Here is a link to my new question about this.Karyosome
B
0

Try to show the ui-dialog-titlebar-close class of dialog

$(".ui-dialog-titlebar-close").show();

And with css (what I am doing)

body .ui-dialog-titlebar-close{
   visibility=visible;
}
Bougie answered 16/7, 2013 at 9:14 Comment(6)
@Karyosome can you please check that css solution ??otherwise I'l delete this post soon :)Bougie
there is no such thing as display:visibleOxyacetylene
where should i put this css ? on jquery.ui.dialog.css ?Karyosome
@Oxyacetylene My bad dude..sorry.Edited.Thanks for the spot.Bougie
should i put $(".ui-dialog-titlebar-close").show(); in js file ?Karyosome
let us continue this discussion in chatBougie
S
0

This works for me:

(Assume your close button has id #close)

$(".ui-dialog-titlebar : not(#close)").hide();
Shenika answered 16/7, 2013 at 9:17 Comment(0)
G
0

Try this one:

    $(".ui-dialog-titlebar").css('visibility','hidden');
    $(".ui-dialog-titlebar-close").css('visibility','visible');

See Demo

Gainly answered 16/7, 2013 at 11:24 Comment(0)
U
0

What about just set height to 0? Seemed work for my needs.

.ui-dialog-titlebar {
  height: 0;
}
Ultimately answered 2/11, 2015 at 15:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.