View Single Post
Old 01-29-2013, 06:28 PM   PM User | #1
gilgimech
New Coder

 
Join Date: Mar 2010
Posts: 58
Thanks: 10
Thanked 3 Times in 3 Posts
gilgimech is an unknown quantity at this point
Help With jQuery PLugin Default Options

I'm not sure what's wrong, but I can't get the default options to work in my plugin.

Here's my Code
Code:
(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;

        });
    };

})(jQuery);
I'm not sure why but all the variables are coming up as undefined. I've written plugins before like this with no problems, but for some reason it's not working

Last edited by gilgimech; 01-31-2013 at 06:00 AM..
gilgimech is offline   Reply With Quote