Revision: 61448
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 14, 2012 04:23 by rickygri
Initial Code
/*
* jQuery Plugin Template
* Rickygri
*/
(function ($) {
var defaults = {
// total: 5
};
var options = $.extend(defaults, options);
var o = options;
var methods = {
init: function () {
},
fire: function () {
}
};
$.fn.popUp = function (methodOrOptions) {
if (methods[methodOrOptions]) {
return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1))
} else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
return methods.init.apply(this, arguments)
} else {
$.error('Method ' + method + ' does not exist');
}
}
})(jQuery);
// Use custom methods
$(".elem").click(function() {
$(this).popUp('fire');
});
Initial URL
Initial Description
This is a skeleton template for a jquery plugin with custom methods
Initial Title
jQuery Plugin Template
Initial Tags
plugin, template, jquery
Initial Language
jQuery