When in coffeescript I try to bind the dragstart event on an image in an onload trigger I get the following error:
Uncaught TypeError: Cannot set property 'ondragstart' of undefined
Here’s my code:
image_url = "some.url"
@image = $ new Image()
@image[0].onload = () =>
@image.on( 'dragstart', () -> false )
@image.attr 'src', image_url
Fixed it with this:
Mouse down, in combination with prevent default..
In this example they do bind it like I do in the question though:
http://eightmedia.github.com/hammer.js/slideshow/
Still wondering what I’m missing here..