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

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

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

23条回答
  •  温柔的废话
    2020-11-29 15:51

    Actually there's yet another way to do it, using the dialog widget directly:

    You can get the Dialog Widget thus

    $("#example").dialog(dialogOpts);
    $dlgWidget = $('#example').dialog('widget');
    

    and then do

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

    to hide the titlebar within that dialog only

    and in a single line of code (I like chaining):

    $('#example').dialog('widget').find(".ui-dialog-titlebar").hide();
    

    No need to add an extra class to the dialog this way, just go at it directly. Workss fine for me.

提交回复
热议问题