extend jquery ui dialog (add more options) -


how can create , add new options jquery dialog? example: through on setting options can control display of title bar or display close button.

the script this:

$("#message").dialog({   showtitle:false,     //new option (hide title bar)   showclosebutton:true //new option (show close button)   modal:true...        //other options }) 

it's little easier expressed in comment.

// store old method later use var oldcr = $.ui.dialog.prototype._create; // add 2 new options default values $.ui.dialog.prototype.options.showtitlebar = true; $.ui.dialog.prototype.options.showclosebutton = true; // override original _create method $.ui.dialog.prototype._create = function(){     oldcr.apply(this,arguments);     if (!this.options.showtitlebar) {        this.uidialogtitlebar.hide();     }     else if (!this.options.showclosebutton) {        this.uidialogtitlebar.find(".ui-dialog-titlebar-close").hide();     } };  // how use $("<div />").dialog({     showclosebutton: false }); // or $("<div />").dialog({     showtitlebar: false }); 

obviously, if titlebar hidden, close button hidden since part of titlebar.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -