This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / Ask a simple question: On a web page, if I drag a field item to hit another item, hoping to fire a drag-and-drop event, how does onmouseover event get fired while onmousedown event is still running?
-nicetomeetyou(淡定灌水);
2010-3-25
(#5969956@0)
-
这个mousedown fire一下就完了吧。
-coolmao(酷猫*Zensunni);
2010-3-25
(#5970197@0)
-
You are right. I found out that if you push mouse without pressing any button down is OK to fire mouseover on another item, but, if you press button down, different story.
-nicetomeetyou(淡定灌水);
2010-3-26
(#5971549@0)
-
哦,没试过。感觉这个down你一按下就完了,不会老在那里fire.
-coolmao(酷猫*Zensunni);
2010-3-26
(#5971561@0)
-
牛哥,强烈建议换个马甲发技术贴,这个马甲只发革命事迹。
-tjhong(啊哈);
2010-3-26
(#5971806@0)
-
Can't believe you ask such a question. Thought you have answers for everything.Kidding.
-thornthorn(Holy Moly);
2010-3-26
{8}
(#5971814@0)
-
So, give me some suggestion. no kidding, I never wrote any JS for drag and drop before, and the current one has some problem. Be honest, man.
-nicetomeetyou(淡定灌水);
2010-3-26
(#5971901@0)
-
以为牛哥在给五年级的班上上课,结果发现他在二年级的班上到处问问题。。。
-nodream(~~~);
2010-3-26
(#5971817@0)
-
Pre-IT School
-thornthorn(Holy Moly);
2010-3-26
(#5971831@0)
-
know is know, no-know is no-know, ni di ming bai?
-nicetomeetyou(淡定灌水);
2010-3-26
(#5971927@0)
-
害
-nodream(~~~);
2010-3-26
(#5971993@0)
-
coolmao is right, onmousedown is a one-time firing, what I really wanted to know in detail is the "onmousemove" event. When this event is firing, how to write JS to make sure onmouseover is fired immediately and onmousemove is stopped by itself?
-nicetomeetyou(淡定灌水);
2010-3-26
(#5971969@0)
-
In Drag n Drop, once dragging starts it is not possible to play with onmouseover event, 'cause no browser would fire it while mouse is down, and pointing at the object being dragged. What effect you need to achieve?
-u1a037(马鸭树);
2010-3-28
(#5975259@0)
-
unless you are doing a fancy dragging. one such case is you don't put the object directly under mouse. imagine you press mouse down and move, an object 1cm below the click point is following along the mouse cursor and keeping this distance.This way onmouseover event will be fired as mouse cursor is not physically 'blocked" by the object that is being dragged.
just fyi, dojo and jquery, and many others can do most of this type of work, unless your requirement is really special.
-u1a037(马鸭树);
2010-3-28
{246}
(#5975578@0)
-
"'cause no browser would fire it while mouse is down" -- Not true. This is the problem description on my test page. (#5948178@0) Apparently it can be fired, but not for every "mouseover".
-nicetomeetyou(淡定灌水);
2010-3-29
(#5976376@0)
-
not sure how I could be more clear. I said it was not possible when 1) mouse down AND 2) mouse cursor already poniting an object. (it is under the mouse).you keep thinking mouseover in this situation, which is wrong direction. just read source code of jquery and dojo, you'd know this type of thing had been implemented fully and well documented. such as when a draggable object over/out droppable object. all is in mousemove event with coordinates.
-u1a037(马鸭树);
2010-3-29
{296}
(#5977173@0)
-
"1) mouse down AND 2) mouse cursor already poniting an object. " --- In my test case, both happen to invoke onmouseover event, but not every time. If you are interested, I show your URL.
-nicetomeetyou(淡定灌水);
2010-3-30
(#5978690@0)
-
yes, please. in DnD, mouseover/out event handler should be nulled out. My understanding is when you do that "in right angel and with some speed", the draggable object is not under mouse cursor however it appears to be.
-u1a037(马鸭树);
2010-3-30
(#5980203@0)
-
PMed
-nicetomeetyou(淡定灌水);
2010-3-30
(#5980656@0)