TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Superior jQuery plugin template

46 pointsby nvitasabout 13 years ago

5 comments

deadbeef84about 13 years ago
Here's my thoughts:<p>1. Ability to modify default settings It is sometimes nice to set the global defaults.<p>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.<p>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.<p>4. Missing var before $settings. Just a typo I guess?<p>5. I think the name generate() is a bit misleading, init() or initialize() makes more sense to me.
评论 #3725065 未加载
评论 #3725008 未加载
评论 #3724978 未加载
paulirishabout 13 years ago
A recipe like this (also a tooltip), but approved by the jQuery team and with much more explanation is available at <a href="http://docs.jquery.com/Plugins/Authoring" rel="nofollow">http://docs.jquery.com/Plugins/Authoring</a>
评论 #3726151 未加载
Rustabout 13 years ago
Just wanted to let you know I used your boilerplate for my first jQuery plugin recently - <a href="https://github.com/indyarmy/jQuery.awesomeCloud.plugin/" rel="nofollow">https://github.com/indyarmy/jQuery.awesomeCloud.plugin/</a><p>Thanks a lot, it saved me a pile o'trouble :)
AndrewHamptonabout 13 years ago
The first line of $.fn.wTooltip is<p><pre><code> if(typeof option === 'object') </code></pre> Does anyone know where option is declared and where its value is set?
评论 #3724744 未加载
评论 #3724737 未加载
emehrkayabout 13 years ago
Crockford must be rolling over in his bed right now