thdoan / magnify

A lightweight jQuery magnifying glass zoom plugin.
https://thdoan.github.io/magnify/
MIT License
243 stars 63 forks source link

Firefox Image Map Click Through - Possible Fix #59

Closed marketinview closed 5 years ago

marketinview commented 5 years ago

Currently, the image map demo click through doesn't work in Firefox..it requires two clicks. I had the need to do a click through and found a method that works in Firefox (as well as Chrome and Edge) to fire a click at a specific x,y:

function clickxy(x, y) {
    var ev = new MouseEvent('click', {
        'view': window,
        'bubbles': true,
        'cancelable': true,
        'clientX': x,
        'clientY': y
    });
    var el = document.elementFromPoint(x, y);
    el.dispatchEvent(ev);
} 
thdoan commented 5 years ago

This was a variable scope issue and has been fixed in v2.3.3. Please test the updated demo you linked to above (be sure to Shift + F5) and close if it works for you.

marketinview commented 5 years ago

Fix confirmed.