Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Mar 2010
    Posts
    58
    Thanks
    10
    Thanked 3 Times in 3 Posts

    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 07:00 AM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •