Your event trigger seems to work just fine, according to my fiddle.
$(document).bind('keydown', function(e) {
e.preventDefault();
var d = new Date();
$('#log').html(
'time: ' + d.getTime() + '<br/>' +
'key: ' + e.which + '<br/>' +
'ctrl: ' + (e.ctrlKey ? 'Yes' : 'No')
);
});
However, you seem to be asking how to control the browser's zoom level, which isn't possible in most (if any) browsers without a plugin.
You could implement zooming of your own using CSS and Javascript, and even use the above snippet to capture Ctrl +
and Ctrl -
but you wouldn't be able to prevent the user zooming the page in other ways.
CSS:
.text-zoom-0{
font-size: .75em;
}
.text-zoom-1{
font-size: 1em;
}
.text-zoom-2{
font-size: 1.25em;
}
Javascript:
jQuery(function($) {
var currentZoom = 1,
minZoom = 0,
maxZoom = 2,
changeZoom = function(increase) {
var newZoom = currentZoom;
if (increase && currentZoom < maxZoom) {
newZoom++;
$('.text-zoom-' + currentZoom)
.addClass('.text-zoom-' + newZoom)
.removeClass('.text-zoom-' + currentZoom);
} else if (currentZoom > minZoom) {
newZoom--;
$('.text-zoom-' + currentZoom)
.addClass('.text-zoom-' + newZoom)
.removeClass('.text-zoom-' + currentZoom);
}
currentZoom = newZoom;
};
$('.zoomIn').click(function(e) {
changeZoom(true);
});
$('.zoomOut').click(function(e) {
changeZoom(false);
});
});
And of course you'd have to do the same for images, navigation, and every other element on the page. If you wanted to actually do this, you could be much more clever about the CSS than this little snippet, but remember, could is not the same as should by any stretch of the imagination...