Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- */
- (function ($) {
- PluginName = function () {
- this.init.apply(this, arguments);
- };
- PluginName.prototype = {
- constructor: PluginName.prototype.constructor,
- options: {
- },
- init: function (element, options) {
- //main element
- this.$element = element;
- //set options
- this.options = this.setOptions(options);
- this.setElements();
- this.setEvents();
- },
- setElements: function () {
- console.log('setElements');
- },
- setEvents: function () {
- console.log('setEvents');
- },
- setOptions:function(options) {
- var options = $.extend(true, {}, this.options, options);
- //check options on the node
- var pluginnameRe = new RegExp('^pluginName');
- var data = this.$element.data();
- for (var i in data) {
- if(i.indexOf('pluginName')==0 && data.hasOwnProperty(i)) {
- }
- }
- }
- };
- //jquery plugin implementation
- $.fn.pluginName = function(options) {
- return this.each(function() {
- if(!$(this).data('PluginName'))
- $(this).data('PluginName', new PluginName(this, options));
- });
- };
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement