2

I have divs which are set draggable="true" and which have a dragstart handler. In the handle I setDragImage(image, 0, 0); and it usually works. But every fifth time or so I try to drag (and always the first time), it seems like the image isn't loaded and so the browser doesn't setDragImage.

How can I fix this and ensure the image is loaded/used as the drag image everytime? A friend of mine said canvas might help.

j0k
  • 22,600
  • 28
  • 79
  • 90
Pauly Dee
  • 737
  • 2
  • 9
  • 17

1 Answers1

1

Probably image is not loaded in the point you call setDrawImage()

You might want to use an image preloader:

Preloading images with jQuery

Community
  • 1
  • 1
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435