jquery UI dialog: how to initialize without a title bar?

前端 未结 23 1778
春和景丽
春和景丽 2020-11-29 15:03

Is it possible to open a jQuery UI Dialog without a title bar?

23条回答
  •  半阙折子戏
    2020-11-29 16:06

    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.

提交回复
热议问题