glarkou
glarkou

Reputation: 7101

Mousedown and Up not working

I used mouseup/down/move to manually implement jQuery.draggable functionality. Everything was working fine until I tried to move my div inside a jQuery popup window.

After moving the div

dialogOpenMultiple("Title", "1234", "<div id=\"include\"></div>");
$('.autosize').appendTo('#include');

I faced two problems:

  1. Firstly, the cursor is not moving bellow my mouse cursor because of some issue with offset and pageX, pageY.

  2. While mousemove is working mouseup / drag / mousedown is not working because of the default browser's functionality which selects and tries to move the actual picture.

Please look the not working sample here:

- Sample

Working sample:

- Sample

Upvotes: 2

Views: 607

Answers (2)

mhps
mhps

Reputation: 166

updated fiddle showing working draggable.

http://jsfiddle.net/NMpwU/1/

added e.preventDefault(); to mousedown function and changed the if (newdiv == null) to if (newdiv === null)

Upvotes: 1

Daniel Moses
Daniel Moses

Reputation: 5858

1) Easily fixed using cursor css. This will give a much better user experience. cursor:url(linkCursor.png), pointer;

2) You can stop browser default actions by adding e.preventDefault() to your events.

Upvotes: 1

Related Questions