After much research and very little code, I’ve come up with a basic start to a jQuery zoom event handler. Don’t laugh. This is very basic, but it handles zoom events based on keyboard shortcuts and fires the handler.
UPDATE: You can find the latest version of the plugin here.
jQuery.fn.zoom = function(fn) {
jQuery(document).keypress(function(e){
if (e.ctrlKey && (e.which == 61 || e.which == 45)) fn();
});
};
jQuery(document).keypress(function(e){
if (e.ctrlKey && (e.which == 61 || e.which == 45)) fn();
});
};
You could then assign a handler like so:
jQuery(document).zoom(function(){
alert('zoom, zoom');
});
alert('zoom, zoom');
});
So much more needs to be added to this and I’m not even sure I’m headed the right direction. For example, I can address another way of zooming (CTRL-scrollwheel), but I doubt I can capture use of the menu in the browser. Also, I could probably assign different keys to zoom. I might have to come up with a different solution entirely.
Good luck with this! I think such a function would be obscenely useful.
Thanks! I’ve poured a bunch of work into the plugin and it’s ready for a release: http://design.mellentine.com/2008/12/11/javascript-jquery-zoom-event-plugin/