I'm new to JQuery and still exploring what it can do. I'm curious to
know more about chaining, how it should be used, and what it can/can't
handle.

I tried one experiment that I've listed code for below. The intention
was to see if I could chain mouse event handlers for different
objects, but it didn't quite work. Maybe the chaining is creating
collisions? Maybe I've got chaining all wrong? Could you offer some
clarification? Thanks!

$(document).ready(function() {
        var timerId = 0;
        var nState = 0;
        $("#wrapAll")
                .children("#aBox")
                        .mousemove(function() {
                                if(nState == 1) {
                                        clearTimeout(timerId);
                                        timerId = setTimeout('$("#aChild 
p").html("Scheduler Complete!")',
2000);
                                }
                        })
                        .mouseover(function() {
                                ++nState;
                                if(nState == 1) {
                                        timerId = setTimeout('$("#aChild 
p").html("Scheduler Complete!")',
2000);
                                }
                                $("#wrapAll p#bottomText").html(nState);
                        })
                        .mouseout(function() {
                                --nState;
                                if(nState != 1) {
                                        clearTimeout(timerId);
                                }
                                $("p").empty();
                                $("#wrapAll p#bottomText").html(nState);
                        })
                .end()
                .children("#aChild")
                        .mouseover(function() {
                                ++nState;
                                $("#wrapAll p#bottomText").html(nState);
                        })
                        .mouseout(function() {
                                --nState;
                                $("p").empty();
                                $("#wrapAll p#bottomText").html(nState);
                        })
                .end();
});

Reply via email to