Question

var mouseStillDown = false;
$(".grab").mousedown(function(e) {
        mouseStillDown=true;
        getLocation();
    }).mouseup(function(e) {
        mouseStillDown = false;
        getLocation();
    });

if(mouseStillDown) {
$("#image_360").bind("mousemove", function(e){
     $("#location").text("e.pageX: " + e.pageX + ", e.pageY: " + e.pageY);
});
}

else if(!mouseStillDown) {
    $("#image_360").unbind("mousemove", function(e){
     $("#location").text("removed location");
    });
}

Even though I have unbound mousemove, I still get text with pageX and pageY showing up on my div with id=location

Was it helpful?

Solution

It should be $("#image_360").unbind("mousemove");

http://api.jquery.com/unbind/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top