PDA

View Full Version : Disabling zoom in and zoom out



jagdeesh
02-01-2011, 11:25 AM
Hi i m using the below code to disable ctrl+ and ctrl- (zoom in/out using keyboard). The below code is working in firefox but it is not working in IE.

The return false; is not working in IE. can you please some one help in this?

$(document).ready(function()
{
var ctrlDown = false;
var ctrlKey = 17, vKey = 189, cKey = 187;

$(document).keydown(function(e)
{

if (e.keyCode == ctrlKey) ctrlDown = true;
}).keyup(function(e)
{
if (e.keyCode == ctrlKey) ctrlDown = false;
});

$(document).keydown(function(e)
{
//alert(ctrlDown);

if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey))
return false;
});
});

Please provide me do you have any other code to do this?

Thanks,
Jagadeesh.

gusblake
02-01-2011, 11:39 AM
IE won't let you do it. What would be the point anyway?

jagdeesh
02-01-2011, 12:46 PM
Thanks for your reply.

Is there any other way to do it. Because I need to implement it for my websites. It will be very helpful if you tell any idea?

Thanks,
Jagadeesh.

Spudhead
02-01-2011, 12:58 PM
It's a usability feature built into browsers, for a good reason: users should be able to increase (and decrease) the size of text and images to match their eyesight. If it's somehow breaking your site layout, then rather than seeking ways to disable this functionality - which, as has been pointed out, isn't going to work - you should be concentrating your efforts on building a site that accommodates various zoom settings.