View Full Version : jQuery snap to grid

12-24-2010, 10:13 PM

I'm having a little problem with my jQuery.
This is my code:

$(this).stop(true,false).keypress(function(event) {

function keypressed(){
var key = (event.keyCode);
if (key == 39){
$('.megaman').html('<img src="new.gif"/>');
left: '+=12',
}, 10, function() {
$('.megaman').html('<img src="new.gif"/>');


Basically, when a key is pressed the image will move across the screen, I would like it so that when it moves it snaps to a 20x20 grid.

How would I be able to do this?


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum