There was a request recently on the jQuery discussion list for an enhancement to Ritesh Agrawal’s Simple Star Rating System to allow for 1/2 star ratings. So I took it upon myself to add the feature.
Beta 2 of the clueTip Plugin for jQuery is out the door and on the server. I’ve made a number of fairly significant changes (for the better, I hope), both to the script and to the CSS. One notable addition is the ability to apply a “jTip” style to the clueTips by changing the CSS, setting the new “arrows” option to
true and the new “dropShadow” option to
false. Here is the full list of what has been changed:
Read the rest of this entry »
A common pattern in jQuery plugin development is the need to undo what the plugin has done. This is usually handled through a method prefixed with “un”. Another common pattern is the use of anonymous functions for event handlers. Unbinding events is easy with jQuery but unbinding a single event handler requires the use of a named function. jQuery 1.2 now provides another option for binding and unbinding events: event namespaces.
I’ve been developing jQuery plugins for quite a while now, and I’ve become rather comfortable with a particular style of plugin development for my scripts. This article is meant to share the pattern that I’ve found especially useful for plugin authoring. It assumes you already have an understanding of plugin development for jQuery; if you’re a novice plugin author, please review the jQuery Authoring Guidelines first.
There are a few requirements that I feel this pattern handles nicely:
- Claim only a single name in the jQuery namespace
- Accept an options argument to control plugin behavior
- Provide public access to default plugin settings
- Provide public access to secondary functions (as applicable)
- Keep private functions private
- Support the Metadata Plugin
I’ll cover these requirements one by one, and as we work through them we’ll build a simple plugin which highlights text.