jquery Programming Glossary: mousex
registering clicks on an element that is under another element http://stackoverflow.com/questions/1148424/registering-clicks-on-an-element-that-is-under-another-element if clicked point taken from event is inside element var mouseX e.pageX var mouseY e.pageY var offset this .offset var width.. .offset var width this .width var height this .height if mouseX offset.left mouseX offset.left width mouseY offset.top mouseY.. this .width var height this .height if mouseX offset.left mouseX offset.left width mouseY offset.top mouseY offset.top height..
Horizontal scroll on mouseMove - wide div in smaller div with overflow:hidden (Can't get the math to work) http://stackoverflow.com/questions/16050564/horizontal-scroll-on-mousemove-wide-div-in-smaller-div-with-overflowhidden-c ' innerBoxWidth ' box.scrollLeft ' box.scrollLeft var mouseX e.pageX var boxMouseX mouseX boxOffset if boxMouseX offsetPx.. ' box.scrollLeft var mouseX e.pageX var boxMouseX mouseX boxOffset if boxMouseX offsetPx boxMouseX boxWidth offsetPx..
How to drag images / objects within Canvas? http://stackoverflow.com/questions/18333936/how-to-drag-images-objects-within-canvas c.fillRect 0 0 500 500 image1.update image2.update 30 var mouseX 0 mouseY 0 var mousePressed false var dragging false canvas.mousemove.. false var dragging false canvas.mousemove function e mouseX e.offsetX mouseY e.offsetY document .mousedown function mousePressed.. top that.y var bottom that.y img.height if drag startX mouseX that.x startY mouseY that.y if mouseX right mouseX left mouseY..
registering clicks on an element that is under another element http://stackoverflow.com/questions/1148424/registering-clicks-on-an-element-that-is-under-another-element free #topelement .click function e .box .each function check if clicked point taken from event is inside element var mouseX e.pageX var mouseY e.pageY var offset this .offset var width this .width var height this .height if mouseX offset.left mouseX.. element var mouseX e.pageX var mouseY e.pageY var offset this .offset var width this .width var height this .height if mouseX offset.left mouseX offset.left width mouseY offset.top mouseY offset.top height this .click force click event share improve.. e.pageX var mouseY e.pageY var offset this .offset var width this .width var height this .height if mouseX offset.left mouseX offset.left width mouseY offset.top mouseY offset.top height this .click force click event share improve this answer..
Horizontal scroll on mouseMove - wide div in smaller div with overflow:hidden (Can't get the math to work) http://stackoverflow.com/questions/16050564/horizontal-scroll-on-mousemove-wide-div-in-smaller-div-with-overflowhidden-c function e console.log 'boxWidth ' boxWidth ' innerBoxWidth ' innerBoxWidth ' box.scrollLeft ' box.scrollLeft var mouseX e.pageX var boxMouseX mouseX boxOffset if boxMouseX offsetPx boxMouseX boxWidth offsetPx var left boxMouseX innerBoxWidth.. ' boxWidth ' innerBoxWidth ' innerBoxWidth ' box.scrollLeft ' box.scrollLeft var mouseX e.pageX var boxMouseX mouseX boxOffset if boxMouseX offsetPx boxMouseX boxWidth offsetPx var left boxMouseX innerBoxWidth boxWidth boxWidth offsetPx..
How to drag images / objects within Canvas? http://stackoverflow.com/questions/18333936/how-to-drag-images-objects-within-canvas path2 300 100 var loop setInterval function c.fillStyle gray c.fillRect 0 0 500 500 image1.update image2.update 30 var mouseX 0 mouseY 0 var mousePressed false var dragging false canvas.mousemove function e mouseX e.offsetX mouseY e.offsetY document.. image2.update 30 var mouseX 0 mouseY 0 var mousePressed false var dragging false canvas.mousemove function e mouseX e.offsetX mouseY e.offsetY document .mousedown function mousePressed true .mouseup function mousePressed false dragging.. var left that.x var right that.x img.width var top that.y var bottom that.y img.height if drag startX mouseX that.x startY mouseY that.y if mouseX right mouseX left mouseY bottom mouseY top if dragging dragging true drag true..
|