
Untitled
By: a guest on
May 25th, 2012 | syntax:
None | size: 0.87 KB | hits: 11 | expires: Never
## [Javascript]
(function($) {
/**
* Delegate to listen for events
*/
$.fn.pluginName = function(selector) {
// Listen for user interactions matching the component
return this.delegate(selector, {
click : init,
keydown : init
});
}
/**
* Initiaizes the search component if it hasn't already been initialized.
*/
function init(event) {
// If the component has not been intialized, initialize it.
if (!$(this).data("pluginName.initialized")) {
$(this).data("pluginName.initialized", true);
component.apply(this, event);
}
}
function component(event) {
// TODO: Setup component code here
$(this).bind({
click : function() { },
keydown : function() { }
});
// Refire event for component
$(event.target).trigger(event.type);
}
})(jQuery);