-
-
Save andreineculau/27be426e793559d1ce4d69bc42a3c32d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let elementsFromPoint = function(x, y) { | |
let items = []; | |
let element; | |
do { | |
element = document.elementFromPoint(x, y); | |
if (!element || element === (items[0] || {}).element) { | |
break; | |
} | |
items.unshift({ | |
element, | |
value: element.style.getPropertyValue('pointer-events'), | |
priority: element.style.getPropertyPriority('pointer-events') | |
}); | |
element.style.setProperty('pointer-events', 'none', 'important'); | |
} while (true); | |
_.each(items, function(item) { | |
item.element.style.setProperty( | |
'pointer-events', | |
item.value ? item.value : '', item.priority | |
); | |
}); | |
return _.map(items, 'element'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment