Skip to content

Instantly share code, notes, and snippets.

@jpoz
Created February 26, 2010 05:14
Show Gist options
  • Select an option

  • Save jpoz/315439 to your computer and use it in GitHub Desktop.

Select an option

Save jpoz/315439 to your computer and use it in GitHub Desktop.
$.engineer.define('example_button', {
defaults: { color: '#336699', innerText: "This element" },
structure: function(options) {
var div = $('<div/>', {
css: {
'text-align':'center', 'background':options.color, 'color':'white',
'padding':'5px', 'margin':'5px', 'width': '140px', 'display': 'inline'
},
html: options.innerText
});
return div;
},
behavior: function(options) {
var self = this;
self.click(function() {
self.animate({ opacity: 0.4 }, 1500 );
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment