> Well, that sort of works, although I need to be able to pass (and  
> within the plugin provide default) options - I can do either but not  
> both so I'm a bit stumped:

Oh, I see what you mean now.  Try something like this:

$.fn.myplugin = function(options) {

    var defaults = { width: 300 };

    if (typeof options == 'string')
        options = { someDefaultOption: options };
    else if ($.isFunction(option))
        options = { callback: options };

    options = $.extend(defaults, options);

    ...
};




Reply via email to