Superior jQuery plugin template
websanova.com
Superior jQuery plugin template
1–10 of 17 posts
Re: Superior jQuery plugin template
#2 if(typeof option === 'object')
Does anyone know where option is declared and where its value is set?Re: Superior jQuery plugin template
#3The first line of $.fn.wTooltip is if(typeof option === 'object') Does anyone know where option is declared and where its value is set?
$.fn.wTooltip = function(option, settings)Re: Superior jQuery plugin template
#4The first line of $.fn.wTooltip is if(typeof option === 'object') Does anyone know where option is declared and where its value is set?
$("#bla").wTooltip({foo: "bar"})Re: Superior jQuery plugin template
#5Re: Superior jQuery plugin template
#61. Ability to modify default settings It is sometimes nice to set the global defaults.
2. Ability to expose methods. A nice way of calling the someFunc() would be nice. I guess you can do it like this: $(...).data('_wTooltip').someFunc(); but using the data() seems a bit hacky.
3. Use settings from html5 data-attribute, ie data-tooltip='{"foo":"baar"}'. Not really necessary for the example plugin, but I think it could be for others. I hate it when I need initialize every instance separately just to specify it's options, when they could be specified in the markup.
4. Missing var before $settings. Just a typo I guess?
5. I think the name generate() is a bit misleading, init() or initialize() makes more sense to me.
Re: Superior jQuery plugin template
#7Here's my thoughts: 1. Ability to modify default settings It is sometimes nice to set the global defaults. 2. Ability to expose methods. A nice way of calling the someFunc() would be nice. I guess you can do it like this: $(...).data('_wTooltip').someFunc(); but using the data() seems a bit hacky. 3. Use settings from html5 data-attribute, ie data-tooltip='{"foo":"baar"}'. Not really necessary for the example plugin,…
Re: Superior jQuery plugin template
#8Re: Superior jQuery plugin template
#9Here's my thoughts: 1. Ability to modify default settings It is sometimes nice to set the global defaults. 2. Ability to expose methods. A nice way of calling the someFunc() would be nice. I guess you can do it like this: $(...).data('_wTooltip').someFunc(); but using the data() seems a bit hacky. 3. Use settings from html5 data-attribute, ie data-tooltip='{"foo":"baar"}'. Not really necessary for the example plugin,…
Re: Superior jQuery plugin template
#10Here's my thoughts: 1. Ability to modify default settings It is sometimes nice to set the global defaults. 2. Ability to expose methods. A nice way of calling the someFunc() would be nice. I guess you can do it like this: $(...).data('_wTooltip').someFunc(); but using the data() seems a bit hacky. 3. Use settings from html5 data-attribute, ie data-tooltip='{"foo":"baar"}'. Not really necessary for the example plugin,…
I didn't use init() because sometimes I may use init to do something else that doesn't deal with generating the plugin code, so I ended up going with generate(), maybe create() would be a better word.