且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将javascript事件从一个元素传递到另一个元素?

更新时间:2023-11-10 08:00:10

希望我理解OP,但你可以复制原始事件发生后任何选择器上的事件: http://jsfiddle.net/Cr9Kt/1/

Hope I understand the OP, but you can replicate the event on any selector after the original event has occurred: http://jsfiddle.net/Cr9Kt/1/

在链接的示例中,我将事件放在顶层,并在底层创建一个类似的事件。你可以通过点击每个元素(而不是整个顶部和底部)来进一步采取这一点。

In the linked sample, I take the event on the top layer and create a similar event fired on the bottom layer. You can take this further with any individual clicking of each element(as opposed to top and bottom as a whole).

这是另一个问题的借来的想法:在特定坐标处触发JavaScript click()事件

This is a borrowed idea from another question: Triggering a JavaScript click() event at specific coordinates