Op zaterdag 16-12-2006 om 19:45 uur [tijdzone +0100], schreef Jörn
Zaefferer:

Thank you for your code, I'm impressed. It works indeed :-) ... And I
need to learn alot about javascript!

To understand it better I'm going to comment on it. Maybe you can
correct me if I'm wrong. I don't think I grasp it fully and I don't
understand why you don't work with a timer as others say you have to

If I understand it correct you basicly do a simple thing. With the
function toggle you always know wich direction a block should go.
"Direction" gives later on slideUp or SlideDown.

What I don't understand is: How the little program knows how to close
the menu. Even when its opening and you go out before the animation is
completed.

It would make a great tutorial for the jquery blog?

example on : http://www.enquest.eu/test.html

Jörn Zaefferer
example on : http://www.enquest.eu/test2.html

Enquest



menu code:


$(function() {
        var toggle = function(direction, display) {
                return function() {
                        var self = this;
                        var ul = $("ul", this);
                        if( ul.css("display") == display && !
self["block" + direction] ) {
                                self["block" + direction] = true;
                                ul["slide" + direction]("slow",
function() {
                                        self["block" + direction] =
false;
                                });
                        }
                };
        }
        $("li.menu").hover(toggle("Down", "none"), toggle("Up",
"block"));
        $("li.menu ul").hide();
});


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

Reply via email to