Skip to content

Instantly share code, notes, and snippets.

@webolizzer
Last active March 10, 2017 13:55
Show Gist options
  • Save webolizzer/b4cdc6cebf7694a6d5681e526fbe7eb8 to your computer and use it in GitHub Desktop.
Save webolizzer/b4cdc6cebf7694a6d5681e526fbe7eb8 to your computer and use it in GitHub Desktop.
prevent zooming cross-browser with jquery
// 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