How to remove jQuery-ui dialog title bar?

前端 未结 4 1235
闹比i
闹比i 2021-02-02 14:54

I am trying to hide jQuery-ui dialog\'s title bar but keep the close button in the title bar visible. I have searched lots of post on stackoverflow like this one. In each post t

4条回答
  •  [愿得一人]
    2021-02-02 15:11

    The way I see it, you have 3 options.

    1. Yes, eliminate the titlebar completely and add a custom one that you can style to match the default one, using absolute positioning should be the key.
    2. If you have the time, extend (not overwrite) the _create method of the dialog https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.dialog.js#L74 to do what you need
    3. Work with CSS hackery to keep the titlebar there with a height of 0 for all elements but the close button.

    Either one has their cons and pros, I would recommend #2 the best if you can, here's some info on how to work with widgets http://api.jqueryui.com/jQuery.widget/

提交回复
热议问题