Disable or Prevent Browser zoom on , Ctrl+ or Ctrl-, and Ctrl + Mouse scroll.
In my one of application I need to prevent the user, to zoom in and out over all cross browser. For a specific application I would like to disable or prevent the browser zooming feature. For this i have to stop all below way of zooming the browser window.
- Disable keyboard CTRL+ or CTRL- on browser window.
- Disable keyboard CTRL and Mouse scroll key
You can disable zoom in cross browser by Ctrl+ or Ctrl- or Using Ctrl Key + Mouse wheel Up or down by this code.
JQUERY:
[js]
$(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’ ) ) {
event.preventDefault();
}
// 107 Num Key +
// 109 Num Key –
// 173 Min Key hyphen/underscor Hey
// 61 Plus key +/= key
});
$(window).bind(‘mousewheel DOMMouseScroll’, function (event) {
if (event.ctrlKey == true) {
event.preventDefault();
}
});
[/js]
DEMO:
[paypal-donation]