views:

89

answers:

1

I have 2 event handlers:

Y.all(".ptl").on("mouseover", handleOverlay); 
Y.all(".ptl").on("mouseout", handleOverlay);

And I would like to pass an arugment to handleOverlay on mouseout so that the function knows that the user has exited the node and to exit the handleOverlay function.

I have attemped to follow the API http://developer.yahoo.com/yui/3/api/YUI.html#method_on which to me indicates that it should be:

Y.all(".ptl").on("mouseout", handleOverlay, null, null, null, {arg: "myarg});

however in handleOverlay, assuming that the first argument is the node, the second argument is undefined, prior to the on method, and then null after instead of containing the object passed to it.

function handleOverlay(node, te) {}

node = node object in question (as expected)

te = undefined prior to the mouseover, and null after the mouseout.

I'm sure I'm missing something simple, Thanks.

A: 
function mousedOver(e, arg1, arg2, arg3) {
    //blah blah blah arg1 arg2 arg3
}   

Y.all("#target").on("mouseover", mousedOver, null, "foo", "bar", "baz");

You can pass whatever you want in as those custom arguments. Objects, strings, function references... go nuts!

Tivac
Thanks a ton, I must have been mis-reading the API thinking that only the 6th spot was for the arguments.