Jonathan Sharp schrieb:
> I finally got around to finishing the pages and packaging the plugin 
> last night. Enjoy!
>  
> http://jdsharp.us/code/jQuery/plugins/jdMenu/
Great to see an update to this plugin!

Have you considered or tried an event delegation approach? That is, 
assign the click handlers to the entire menu instead of each li, and use 
the event's target property then. You'd have less event handlers, though 
more code to figure what to do when the event is fired. And you can add 
and remove as many elements as you like, there would be no need to un- 
or rebind any event handlers.

For 1.1 compability, I think the only thing you have to change is 
ancestors() to parents().

Maybe we should move ancestorsUntil (or rather, parentsUntil) and 
next/prevUntil to it's own plugin. You could then provide both 
jdMenu-only package and a jdMenu-with-dependencies package.

The bgiframe plugin is really easy to use, you just apply it to all 
elements that need the iframe.

Of course it would be nice to customize the behaviour via options, but 
that was also mentioned before.

And a hint that works from 1.1 on:
The intialization code at the top depends on the $ alias. You can avoid 
that even without the custom alias pattern used for the plugin itself.
As of 1.1, a reference to the jQuery function is passed as an argument 
to the document ready event. So you can rewrite this:

$(function(){
        $('ul.jd_menu').jdMenu();
        $(document).bind('click', function() {
                $('ul.jd_menu ul:visible').jdMenuHide();
        });
});

To this:

jQuery(function($){
        $('ul.jd_menu').jdMenu();
        $(document).bind('click', function() {
                $('ul.jd_menu ul:visible').jdMenuHide();
        });
});

And none of the code would depend any more on the $ alias being present.

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to