that's a nice upgrade Brice!
On Sun, Mar 1, 2009 at 9:21 AM, Brice Burgess <b...@iceburg.net> wrote: > > Plugin Page: http://dev.iceburg.net/jquery/jqModal/ > > updated jqModal to +r14 > > Changes include smart detection of the triggering element. This allows you > to call $.jqmShow() and $.jqmHide() within the event context of a > non-initialized triggering element, and that element will mask a proper > initialized trigger. > > This (very minor) change is intended to improve the plugin's natural > behavior -- that is; to behave as expected. It will make "live querying" > modal triggers easier for some. > > A simple example of the new behavior follows. It will show and load the > remote content of all anchor links into the modal window whenever they are > clicked. > > ==== > > <a href="http://my.ajax/content">open modal with my.ajax/content</a> > > <div id="jqModal" class="jqmWindow" style="display: none;"></div> > > <script type="text/javascript"> > > jQuery().ready(function($){ > > // initialize modal, > // load the container with a remote return based on the 'href' > // attribute of triggering element(s) > > $('#jqModal').jqm({ajax:'@href'}); > > > // open the modal whenever anchor links on the page are clicked > $('a').live('click',function(){ > $('#jqModal').jqmShow(); > }); > > > }); > </script> > > ==== > > > NOTE: Before this change, you would normally either > > a) pass triggers on $.jqm() initialization (e.g.) > $('#jqModal').jqm({trigger:'a.openModal',...}); > > or > > b) pass the triggering element to $.jqmShow() calls -- > [which you still can, and which will override auto-detection.] > $('a.openModal').click(function(){ > $('#jqModal').jqmShow(this); > }); > $('#jqModal').jqmShow($('a.openModal')[0]); > I realize the new behavior is similar to b) above, but passing the > element to $.jqmShow() did not seem a "natural" fit. The new method is > easier for those without scope/context knowledge [and the new method uses > less bytes in your client code!! ;) (j/k) :pony_skiing==1] > So; I hope you all enjoy. And yes; a rewrite, lint-loving spawn of > jqModal with quiteExpressiveVariableNames is a necessity .... eventually ;) > ~ Brice >