Last active
March 2, 2024 01:44
-
-
Save andrewvaughan/8f6f892bdbc7d5d973879ed909a4aa1e to your computer and use it in GitHub Desktop.
Javascript Bookmark Disable Double-Click Zoom
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
javascript:document.querySelectorAll("*").forEach(e=>{e.style["touch-action"]="manipulation"}),new MutationObserver(e=>{e.forEach(function(e){for(var o=0;o<e.addedNodes.length;o++)e.addedNodes[o].style["touch-action"]="manipulation"})}).observe(document.body,{childList:!0,subtree:!0}); |
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
javascript:document.querySelectorAll("*").forEach(l=>{l.style["touch-action"]="manipulation"}); |
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
// Update style for all existing elements | |
document.querySelectorAll('*').forEach(el => { | |
el.style["touch-action"] = "manipulation"; | |
}); | |
// Add the style to any DOM manipulations | |
(new MutationObserver(elms => { | |
elms.forEach( | |
function(elm) { | |
for (var i = 0; i < elm.addedNodes.length; i++) { | |
elm.addedNodes[i].style["touch-action"] = "manipulation"; | |
} | |
} | |
); | |
} | |
)).observe(document.body, { childList: true, subtree: true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment