tags: Javascript, JQuery date: 2011-12-08 19:27:05.000000000Z

Well, I was playing with a project this week and I was kind of stuck on an old JQuery ui version. Turns out dragging images around, using Chrome, was, at the same time, selecting the image, messing all the stuff around. Something like this:

<script type="text/javascript" language="javascript" charset="utf-8">
  $("img").draggable();
</script>

/lost image//

At the newest version of JQuery ui, the draggable stuff was working normally on Chrome, so I did a research and after an entire day the solution showed up. Fixing it is pretty simple, you should just bind the ‘dragstart’ on the image and prevendDefault().

<script type="text/javascript" language="javascript" charset="utf-8">
  $("img").draggable();
  $('img').bind('dragstart', function(event) { event.preventDefault() });
</script>

/lost image//