Skip to content

Instantly share code, notes, and snippets.

@apipkin
Created May 13, 2010 17:13
Show Gist options
  • Save apipkin/400086 to your computer and use it in GitHub Desktop.
Save apipkin/400086 to your computer and use it in GitHub Desktop.
YUI.add('example',function(Y){
var Example= function(){
Example.superclass.constructor.apply(this,arguments);
};
Y.extend(Example, Y.Overlay,{
className : '',
initializer : function(config) {
this.className = this.getClassName();
this.after('typeChange',this._typeChanged, this);
},
_updateType : function(cur, prev) {
var bb = this.get('boundingBox'),
prevClass = this.className + '-' + prev,
curClass = this.className + '-' + cur;
if(cur) {
bb.replaceClass(prevClass,curClass);
}else if(prev){
bb.removeClass(prevClass);
}
},
_typeChanged : function(e) {
this._updateType(e.newVal, e.prevVal);
}
},{
NAME : 'example',
ATTRS : {
type : {
validator : Y.Lang.isString
}
}
});
Y.Example = Example;
},'0.1',{requires:['overlay']});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment