I am trying to draw rectangles (divs) using mouse events. Here is my code:
http://jsbin.com/apediti/2/edit
Basically I'm doing the following:
On
mousedownI save the mouse coordinates, create a new div with size:width=0,height=0, and bind event handlers formousemoveandmouseup.On
mousemoveI resize the div based on the current mouse position.On
mouseupI unbind the event handlers formousemoveandmouseup.
It seems to work good in Firefox, and even IE 10, but in Chrome sometimes the mousemove event fires only 2 or 3 times, after mousedown, so the drawn div doesn't get resized.
I can't find the reason why. Any help is appreciated.