473,489 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Drag & Drop: Click over img-tag interrupts events in IE

11 New Member
Hello together,

this is my first time posting here, maybe I should introduce myself; my name is David Navratil - Dave will do - and I am working on my final project for my studies at a web programming school.

First off here is the piece that makes me go wild:
http://www.mobil.org/photograph/test.html

There are 3 boxes at the left. When you click "testtest" in the top, you should be able to drag the first box from top. The second box should be draggable normally and so should be number 3.
You can drop the boxes into the big gray box at the right. I know itīs not really pretty, but that makes it simple I hope.

I wrote my own Drag & Drop classes for this, which you can find here:
http://www.mobil.org/photograph/js/dragdrop.js

Now the problem:
Everything works fine (there are actually some minor problems, but nothing problematic) apart from one thing: when trying to drag box nr. 3 in Internet Explorer (my version is 7.0.6001.18000 on Vista, if that helps), it hangs itself up after a small amount of movement. After releasing the mouse button, the dragging doesnīt stop, in fact it begins to work at that moment.
The reason:
I found out why it behaves this way, but I canīt figure out, how to solve the problem. What happens at the moment I click the 3rd box is: the onmousemove-Event stops working. Same happens to the onmouseup-Event, which is why the dragging doesnt drop :) after releasing the mouse-button.
The line for the event is 84 in dragdrop.js:
window.document.onmousemove = this.mousepos;
This happens only with box nr.3, because, as I figured, it contains an img-tag. When using a trigger for the Drag & Drop, which is not an image, like text, for example, or a color-filled div, it works like a charm.

------------------------------
SO THE PROBLEM FOR ME IS :
------------------------------

When pushing a mousebutton directly over an img-tag, events stop firing until I release the mousebutton.
I also tried: window.document.attachEvent("onmousemove",this.mou sepos);
and I also tried leaving the "window." away. It wonīt work. There are also no styles or special treatments for img-tags in this testpage, which could be the reason, everything is inline.

I have been searching about this for last 5 hours and to be honest, I donīt even really know how to call this problem, so I have trouble finding anything on the net.
Hope you people here like having some fun with these things as I do; I just canīt help myself this time.

Before I forget: donīt suggest using frameworks please, I only trust my own code!; I am one of the crazy people.

Best Regards,
Dave
Aug 31 '10 #1
4 2280
David Navratil
11 New Member
I found the problem, it was as stupidly easy. Browsers have these built-in Drag & Drop functionality for images. While using these, events stop working. After having added the following, it worked fine:
document.ondragstart = function(e) { return false; }

The reason I didnīt have problems in Firefox were that I had already put "return false;" into my onmousedown function, which did the job for FF.

Best Regards,
Dave
Sep 1 '10 #2
David Navratil
11 New Member
Now everything is gone. :)
Couldīve guessed that by the way. I wouldnīt ever try to explain that humour to my boss, ha.
Sep 5 '10 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
It's not gone David. It's just been moved to here.

Mary
Sep 6 '10 #4
David Navratil
11 New Member
Oh, thank you very much Mary.

Dave
Sep 6 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4134
by: srikanth | last post by:
Hi all, I have an requirement in one of my projects. We have one aspx page, in that we have two frames, in each frame having a tree structure control(dynamic data). In the left Frame we are...
1
7595
by: Karsten Schramm | last post by:
Hi, if I drag an Outlook.MailItem to a Windows-Explorer window a <subject>.msg file will be created. Now I try to drag & drop a mail item to my own WinForm app. Unfortunately it doesn't work....
2
1735
by: Joseph | last post by:
Hi everyone, Is is possible and how would I implemente dragging and dropping a value in a textbox so that it would clear the existing value in the textbox, if it has one already? TIA Joseph...
3
2191
by: Fred R | last post by:
I'm designing an app in Access 97 that will facilitate the uploading of records and images to a website. The user selects the image thumbnails from the file system and drags them into the app....
2
9171
by: Grey | last post by:
I need to design a workflow application with C#. I want to design an UI with some workflow components which they can be drag & drop anywhere in order to design the workflow for the application...
3
3869
by: Goldwind | last post by:
Hi, I"m trying to use drag & drop of text from one text box to another but without suceess. Microsoft presented an example in "101 code samples" BUT in this example the code select and drag all...
3
2884
by: simchajoy2000 | last post by:
Hi everyone! I am currently working on a user interface project right now where I need to do something similar to how the Visual Studio interface works. In Visual Studio you can drag a button...
1
5360
by: Sim | last post by:
Hello NG, I try to use drag and drop function between two list views. For this I found following code: ...
17
31536
by: Romulo NF | last post by:
Iīve seen some people around the web wondering about a code to reorder table columns using the mouse (drag and drop). Since i had already made one script to reorder table lines (TRīs) i decided to...
1
3798
by: patrickq | last post by:
What am trying to achieve is dragging an element from one IFRAME/FRAME into another IFRAME/FRAME. But upon dropping the element, I do not want the target IFRAME/FRAME to open/load it. I want to set...
0
7108
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.