|
-
Mar 10th, 2008, 09:21 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Disable image dragging in firefox
Hello Everybody,
Is this possible I can disable the browser's (firefox) own image dragging? I am writing my own code to drag images and drop on certail locations on the page but I found that onMouseUp event doesn't fire on the target location until I release the mouse button and click again.
Thanks.
-
Mar 10th, 2008, 09:25 AM
#2
Re: Disable image dragging in firefox
Let's see how you've assigned your event handlers.
-
Mar 10th, 2008, 10:14 AM
#3
Thread Starter
Frenzied Member
Re: Disable image dragging in firefox
http://67.18.159.90/collage/collage.asp?projectid=35
On this page you will see a list of thumbnail images that you can drag and drop into the "Insert Image Here" areas. This works fine on IE but on FF you need to drag the image and drop in on the "Insert Image Here" area and after dropping click again on the target area to get the image.
On the onMouseDown event of thumbnail image, I'm calling this function and assigning the image id to a variable called sourceId.
Code:
function DragImage(imgBox,e)
{
sourceId = imgBox.id;
document.style.cursor = "crosshair";
}
On the onMouseDown event of target images, I'm calling this function to assign the src of the sourceId to target images.
Code:
function DropImage(imgBox)
{
if(sourceId != "")
{
document.getElementById(imgBox.id).src = document.getElementById(sourceId).src;
sourceId = "";
}
}
On the body onMoseUp event, I'm calling this function to empty sourceId and cancel any dragging.
Code:
function CancelDrag()
{
sourceId = "";
}
What I found uptill now is that onMouseUp event on body and image doesn't fire on fire fox but works on IE.
Thanks.
-
Mar 10th, 2008, 07:53 PM
#4
Re: Disable image dragging in firefox
It works fine for me in Firefox. Did you just fix it, or are you using an old version?
-
Mar 11th, 2008, 03:56 AM
#5
Thread Starter
Frenzied Member
Re: Disable image dragging in firefox
I'm using FF 2.0.0.11. I found the solution, I stopped dragging by using e.preventDefault() method.
Thanks.
-
Mar 11th, 2008, 06:19 AM
#6
Re: [RESOLVED] Disable image dragging in firefox
Ah! yes, I should have remembered that in my first post. 
Glad you found it.
-
Jun 8th, 2009, 08:51 PM
#7
New Member
Re: [RESOLVED] Disable image dragging in firefox
I need some help understanding this. I want to disable the firefox image drag on my webpages.
I read about the e.prevent method but not sure how to implement this into my pages.
Can someone give me a bit more detail?
-
Jun 8th, 2009, 09:02 PM
#8
New Member
Re: [RESOLVED] Disable image dragging in firefox
Nevermind. I found out how. I am just learning this stuff.
For those that are like me, here is what you do. Pretty easy actually.
< IMG SRC="yourimage.jpg" onmousedown="event.preventDefault()" >
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|