Home > Web Front-end > JS Tutorial > Can jquery event mousedown and click event be used at the same time?

Can jquery event mousedown and click event be used at the same time?

黄舟
Release: 2017-06-28 09:21:51
Original
2021 people have browsed it

I have a Button with mousedown and click events addedEvents
I want to drag the Button when mousedown

 public  void button_MouseDown(object sender, MouseEventArgs e)
  {
    panel.DoDragDrop(((Button)sender), DragDropEffects.Move);
  }
Copy after login

A window will pop up when click

 private void button_Click(object sender, EventArgs e)
  {
            Form2 fm= new Form2();
            fm.ShowDialog();
  }
Copy after login

But it seems that only the mousedown event works. do not know why?

Turn off the first one and see if the second one works. Leave the first event on, turn off the second event, and see if it has any effect.
Both the last two are turned on and see how it goes. If they can't both respond, it should be a conflict

Because your panel.DoDragDrop operation prevents normal mouse operations mousedown and mouseup. If there is no complete down and up for the same control, there will be no click event.

Well, I tried. Only one of them can respond to mouse events.
How do I realize that I want to drag the Button when the mouse is down, and a window pops up when the mouse is clicked?
How to solve it Are they conflicting?

Register mousedown and mouseup events
What operations should be performed after pressing? Make a mark after pressing, and perform operations when mousemove.


You might as well tell me what you want to achieve. Easy to give you the right direction.

The above is the detailed content of Can jquery event mousedown and click event be used at the same time?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template