What would be the best way to pass the configuration object from the
jquery plugin function call to the entwined object?
Thanks!
On Jan 21, 7:01 am, Venkat <vendi...@gmail.com> wrote:
> I have been using your advice athttp://wiki.github.com/hafriedlander/jquery.entwine/using-entwine-to-...
> to create plugins.
>
> What would be the best way to pass the configuration object from the
> jquery plugin function call to the entwined object?
>
> Thanks!
Easiest is to use Entwine's properties system:
$('.myPlugin').entwine({
Color: 'black',
TabSelector: '> div.tabs'
});
$.fn.myPlugin = function(options) {
$(this).addClass('myPlugin').entwineData(options || {});
});
There are extensions to this pattern, mostly involving overriding the
property getters, that let you also get options from the element's
attributes, or have a 'default' option set on a parent element.
Hamish