Brandon Aaron schrieb:
> I thought about this approach as well but then you gotta think that
> this is a plugin that others will use and possibly other plugins might
> depend on it as well. Then if the defaults changed, the plugin that
> depends on it could be confused and break. It is easy enough for a
> devloper to setup their own set of defaults that would not cause an
> issue like this.
>
> var myHoverDefaults = { interval: 250 };
>
> Now just pass that in and your set and don't potentially break any
> other plugins.
>
> As an example ... I'm updating my bgiframe plugin to accept an options
> hash. If I allowed a developer/plugin to change the defaults then all
> the plugins that depend on the defaults would then break.
>
> Hopefully that all made sense ... I'm writing it in a bit of a rush.
>
Err, maybe, maybe not. Either way, I had a big mistake in my code
example. Corrected:
jQuery.fn.hoverIntent = function (on,off,options) {
var settings = jQuery.extend({}, jQuery.hoverIntent.defaults, options);
...
};
jQuery.hoverIntent = {};
jQuery.extend(jQuery.hoverIntent, {
defaults: { sensitivity: 4, interval: 100 },
setDefaults: function(settings) {
jQuery.extend(jQuery.hoverIntent.defaults, settings);
}
});
I hope that makes more sense.
--
Jörn Zaefferer
http://bassistance.de
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/