JSFiddle - React, Tailwind, and code Playground
by Chase Wilson
JavaScript
var Thumbs = {
_thumbs: null,
options: {
events: ['click','mouseenter','mouseleave'],
event_prefix: 'thumb.'
},
initialize: function(options){
GEG.extend(this.options, options);
var colorWrapper = $('selectble-color-options');
this._thumbs = colorWrapper.select('li a');
this.attachEvents();
},
attachEvents: function(){
var self = this;
this._thumbs.each(function(thumb,index){
self.options.events.forEach(function(event){
thumb.observe(event, function(e){
e.preventDefault();
OAKLEY.fireEvent( self.options.event_prefix + event, [thumb], e );
});
});
});
},
detachEvents: function(){
}
};
OAKLEY.addModule(Thumbs);