Brandon Aaron schrieb:
> Very nice. I believe this will be getting a fair amount of usage!
>
>   
>> - ability to override default settings (sensitivity, polling interval, etc)
>>     
> This would be great and probably should be done by passing an options
> hash as the third argument. Usually options as passed as the first
> argument in plugins but it makes sense to be the third in this case.
>
> I would imagine it looking something like this:
>
> jQuery.fn.hoverIntent = function(f,g,o) {
> o = jQuery.extend({ sensitivity: 4, interval: 100 }, o || {});
> ...
> };
>   
How about this then...

jQuery.fn.hoverIntent = function (on,off,options) {
  var settings = jQuery.extend({}, jQuery.hoverIntent.defaults, options);
...
};
jQuery.hoverIntent = {};
jQuery.extend({ 
        defaults: { sensitivity: 4, interval: 100 },
        setDefaults: function(settings) {
                jQuery.extend(jQuery.hoverIntent.defaults, settings);
        }
});

I like that approach. Gives your users the chance to set defaults 
directly or more then one using setDefaults:

jQuery.hoverIntent.setDefaults({
        interval: 250
});

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to