e.preventDefault() in your mousedown.

- Richard

On Feb 18, 2008 6:28 AM, jquertil <[EMAIL PROTECTED]> wrote:

>
> Hello,
>
> I'm trying to drag an element without the use of any plugin or
> library. The code below works - except when I invoke the mousedown on
> an image element.
>
> In that case, the browser seems to think I want to drag the image off
> the page.
>
> Is there a way to override that? Again, code below works fine on
> elements that aren't images.
>
>
> isMouseDown = false;
> $('#popup').mousedown(function(e){
>        isMouseDown = true;
>        $(document).mousemove(function(e){
>                if(isMouseDown == true){
>                        // ...moving it around
>                }
>        });
> }).mouseup(function(e){
>        isMouseDown = false;
> });
>

Reply via email to