I'm using the jQuery plugin template from CSS-Tricks, but I'm having a problem with the default options.
(function ($) { $.lilRWDMenu = function (el, options) { var base = this; base.$el = $(el); base.el = el; base.$el.data("lilRWDMenu", base); $.lilRWDMenu.defaultOptions = { mainMenuClass: 'main-menu', rwdMenuClass: 'rwd-mobile-menu' }; base.init = function () { base.options = $.extend({}, $.lilRWDMenu.defaultOptions, options); }; base.init(); }; $.fn.lilRWDMenu = function (options) { return this.each(function () { var mainMenuObj = options.mainMenuClass, rwdmenuObj = options.rwdMenuClass; console.log(mainMenuObj ); console.log(rwdmenuObj); }); }; })(jQuery);
For some reason the default options are coming back as 'undefined'.
I can't figure out why it's not working, so if anyone can check my code for me that'll be great.
I'm using the jQuery plugin template from CSS-Tricks, but I'm having a problem with the default options.
For some reason the default options are coming back as 'undefined'.
I can't figure out why it's not working, so if anyone can check my code for me that'll be great.