Choleriker
13 Dec 2006, 10:01 AM
I have had the problem that i dont wanted to make several button icons/css style for disabled toolbar buttons, so i have extended the toolbar-button class that simply sets opacity, so different icons not needed. To enable using of opacity simply set 'disabledOpacity' while adding the button to the toolbar.
YAHOO.ext.ToolbarButton.prototype.enable = function() {
this.disabled = false;
if(this.el){
this.el.removeClass('ytb-button-disabled');
if(this.disabledOpacity)
this.el.setOpacity(1);
}
};
YAHOO.ext.ToolbarButton.prototype.disable = function() {
this.disabled = true;
if(this.el){
this.el.addClass('ytb-button-disabled');
if(this.disabledOpacity)
this.el.setOpacity(this.disabledOpacity);
}
};
UPDATE: make the opacity configurable.
YAHOO.ext.ToolbarButton.prototype.enable = function() {
this.disabled = false;
if(this.el){
this.el.removeClass('ytb-button-disabled');
if(this.disabledOpacity)
this.el.setOpacity(1);
}
};
YAHOO.ext.ToolbarButton.prototype.disable = function() {
this.disabled = true;
if(this.el){
this.el.addClass('ytb-button-disabled');
if(this.disabledOpacity)
this.el.setOpacity(this.disabledOpacity);
}
};
UPDATE: make the opacity configurable.