If you want to do this on a case by case basis it's as simple as
creating the element, appending it to the titlebar and binding a click
handler.

// create anchor to contain icon
$('<a href="#" class="ui-titlebar-other ui-corner-all ui-state-
default"></a>')
    // add icon and text
    .append(<span class="ui-icon ui-icon-minus">other</span></a>')
    // add the anchor to the titlebar
    .appendTo('.ui-dialog-titlebar')
    // bind callback
    .click(function() {
        // do whatever you want
    });

Then you just have to write some CSS to position it where you want.
You'll also need to add all the hover/focus handling, but you can copy/
paste that directly from the dialog plugin.

Creating this in a generic way by adding an option on dialog that
allows you to specify whatever icons you want is a bit more
complicated. But if you want it to work like the buttons option, you
could copy that code and tweak it a bit.


On Nov 14, 5:22 am, lam3r4370 <[email protected]> wrote:
> How to add custom icons to dialog titlebar?I add it in dialog.js and
> css files ,but I want to show them where I choose and this don't work
> for me ,because it add the icons to all dialog titlebars.

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=.


Reply via email to