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,303
  • 28
  • 77
  • 86
Pauly Dee
  • 727
  • 2
  • 9
  • 16

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
  • 76,495
  • 46
  • 227
  • 378