> > I'm putting the finishing touches on a media viewer application that I > coded up recently (think Thickbox). It can be used with jQuery or any > other library. I created an adapter for jQuery, and I thought that > somebody on this list might be interested. > >
Michael, I really love what you've done with shadowbox. But I dislike having to add specific markup to drive the behavior. And as a jQuery user I really want to invoke it like this (for example): $('a[href$=swf]').shadowbox(); So if you're open to suggestion, I'd love to see a minor modification. Here's what I changed to make it more amendable to the jQuery calling style. 1. Added this method to shadowbox.js (just below the current "setup" fn): Shadowbox.setup2 = function(links){ for(var i = 0, len = links.length; i < len; ++i) setupLink(links[i]); }; 2. Added this to shadowbox-jquery.js: jQuery.fn.shadowbox = function() { Shadowbox.setup2(this); }; Now I can call it like this without having to change any markup anywhere, so it becomes a drop-in replacement: $(function() { var options = { /* whatever */ }; Shadowbox.init(options); $('a[href$=swf]').shadowbox(); }); Of course there are more restrictions than one might expect from a traditional jQuery plugin (like not being able to pass options on a per-call basis), but it's a pretty minor change. Food for thought. Mike