I'm working on a little web app where clicking on one div (call it element "A") needs to change the position of itself and another div (call it element "B"), and vice versa.
The functionality would go something like this:
Click 'A' {
A is moved some number of pixels closer to the mouse position (making use of jQuery's .pageX and .pageY event object properties)
B's click event is manually triggered, moving it some number of pixels closer to the mouse
}
I figured I would just bind click event handlers to both A & B. If A were clicked I would manually trigger B's click event (using jQuery's .trigger(), and vice versa. Unfortunately manually triggering the click event for one object from within the other object's handler isn't working for me--e.g. in the example above, I can't retrieve pageX and pageY properties when triggering div B's click event.
I've included an example to illustrate this point here: http://jsfiddle.net/tZFNk/2/.
Cheers and thanks in advance for your help.