简体   繁体   中英

Extending jQuery event object before on handler gets triggered

I cant find a solution for this, so I hope someone here can help me. Im trying to extend the jQuery event object before the event gets triggered on the element.

Eg

anyElem.on("mouseenter", function (e) {}

'e' in this case is the default jQuery event object. But before the event gets triggered I want to extend that object somehow with some properties. Would be cool to do this in a custom jQuery plugin.

I think a way could be adding an eventlistener on capture in vanilla js and modify that event object, but im not sure about this and it would be cool to access the property directly on the jQuery event object and not using the originalEvent property

e.originalEvent.myProperty

Thanks, Daniel

选中它可能对jQuery Event Extensions有帮助

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM