Well, what kind of events. Just attach an event listener to the div you want to control.
var div = document.getElementById('myDiv'); div.addEventListener('mouseenter', function(){
If you want to do this using math, you still need to have an event on the parent element or something else to get the coordinates of the mouse, which will then be stored in the event object that is passed to Chime.
var body = document.getElementsByTagName('body'); var divRect = document.getElementById('myDiv').getBoundingClientRect(); body.addEventListener('mousemove', function(event){ if (event.clientX >= divRect.left && event.clientX <= divRect.right && event.clientY >= divRect.top && event.clientY <= divRect.bottom) {
But it is best to use the above method.
source share