I have some code that works each time onmouseclick and continuously onmousemove when I set them accordingly. I am looking for a way to combine the two (i.e. like a click and
If you don't want to use global variable for dragging, you can use event.buttons for determining which mouse button is pressed.
I tested this code in Chrome and Firefox.
document.onmousemove = function(event) {
if(event.buttons == 1) { //dragged with left mouse button
//your code
}
if(event.buttons > 0) { //dragged with any mouse button
//your code
}
}