Last active
March 10, 2017 13:55
-
-
Save webolizzer/b4cdc6cebf7694a6d5681e526fbe7eb8 to your computer and use it in GitHub Desktop.
prevent zooming cross-browser with jquery
This file contains 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
// prevent zooming cross-browser with jquery | |
// @author http://stackoverflow.com/a/31131948/2337281 | |
$(document).keydown(function(event) { | |
if (event.ctrlKey === true && (event.which == '61' || event.which == '107' || event.which == '173' || event.which == '109' || event.which == '187' || event.which == '189' ) ) { | |
//alert('disabling zooming k'); | |
event.preventDefault(); | |
// 107 Num Key + | |
// 109 Num Key - | |
// 173 Min Key hyphen/underscor Hey | |
// 61 Plus key +/= | |
} | |
}); | |
$(window).bind('mousewheel DOMMouseScroll', function (event) { | |
if (event.ctrlKey === true) { | |
//alert('disabling zooming m'); | |
event.preventDefault(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment