I need to implement a mouse over
after mouse down
, so that when user pressed and move the cells will be opened (minesweeper)
Here's my code !
case 2:
{
if ($(this).hasClass("open") || $(this).hasClass("bomb") || $(this).hasClass("close")) {
var X_axis;
var Y_axis;
$('.close').mousemove(function (event2) {
if ($(this).attr('row') != X_axis && $(this).attr('column') != Y_axis) {
var obj = $("[row='" + X_axis + "'][column='" + Y_axis + "']");
$(obj).addClass("close");
}
$(this).removeClass("close");
X_axis = $(this).attr('row');
Y_axis = $(this).attr('column');
});
}
}
break;
case 2 --> mean left mouse click
oh sorry , here's the solution
use || not && , because the array 2d and maybe current cell x_axis equal to previous cell x_axis ....