mousedown

jQuery mouseup not being detected correctly

巧了我就是萌 提交于 2019-12-02 00:57:23
问题 I have a div that contains a span. I have a mouseup, and mousedown event that should fire when pressing in the div. However it doesn't work correctly. Please go to this fiddle: http://jsfiddle.net/Ym7rM/ If you select the text and then try to drag it, it just detects the mousedown event,but not the mouseup. What am I doing wrong? I'm using Chrome. Thanks EDIT: Sorry, I simplified the question, see the new fiddle. 回答1: The mouseup event is being detected correctly; it's just that the browser

jQuery mouseup not being detected correctly

蹲街弑〆低调 提交于 2019-12-01 23:56:16
I have a div that contains a span. I have a mouseup, and mousedown event that should fire when pressing in the div. However it doesn't work correctly. Please go to this fiddle: http://jsfiddle.net/Ym7rM/ If you select the text and then try to drag it, it just detects the mousedown event,but not the mouseup. What am I doing wrong? I'm using Chrome. Thanks EDIT: Sorry, I simplified the question, see the new fiddle. The mouseup event is being detected correctly; it's just that the browser is not firing a mouseup event after you perform a drag. This is an intentional behavior by the browser. You

hover style can not apply when press mouse button in chrome

*爱你&永不变心* 提交于 2019-12-01 17:18:27
All: [UPDATE] I find another way to implement this, not solution, but just a working trick: Use mousedown as a event trigger(because I need a drag action, so there should be a mousedown event anyway), inside that, bind mouseover event to that span(I do not know why, but bind mouseover inside mousedown can make mouseover work on span) , give it a new class which change the background color; The problem I had with Chrome 40 is: I set a style: span { background-color:red; } span:hover { background-color:blue; } <span>TEST AREA</span> When I mousedown then mouseover, the background-color not

mousedown. propagation on siblings event.targets

白昼怎懂夜的黑 提交于 2019-12-01 05:46:29
I have 2 sibling-nodes with 'position absolute' which both handle mousedown event. How can I trigger the handler of 'div 1' when I am clicking on the transparent area of the 'div 2' (on the pic.) If the overlapping elements are dynamic, I don't believe it is possible to accomplish this using regular event bubbling since the two overlapping elements in question are "siblings". I had the same problem and I was able to solve it with more of a hitTest scenerio where I test if the user's mouse position is within the same area. function _isMouseOverMe(obj){ var t = obj.offset().top; var o = obj

make delayed mousedown event

◇◆丶佛笑我妖孽 提交于 2019-12-01 04:24:02
I have a datagridview which cells has a click event. The cells also have the following mouseDown event: if (e.Button == MouseButtons.Left && e.Clicks == 1) { string[] filesToDrag = { "c:/install.log" }; gridOperations.DoDragDrop(new DataObject(DataFormats.FileDrop, filesToDrag), DragDropEffects.Copy); } whenever I try to click a cell, the mousedown event instantly fires and tries to drag the cell. How can I make the mousedown event fire only if user has holded mouse down for 1 second for example? Thanks! The proper way to do this is not by time but to trigger it when the user moved the mouse

make delayed mousedown event

旧巷老猫 提交于 2019-12-01 02:15:26
问题 I have a datagridview which cells has a click event. The cells also have the following mouseDown event: if (e.Button == MouseButtons.Left && e.Clicks == 1) { string[] filesToDrag = { "c:/install.log" }; gridOperations.DoDragDrop(new DataObject(DataFormats.FileDrop, filesToDrag), DragDropEffects.Copy); } whenever I try to click a cell, the mousedown event instantly fires and tries to drag the cell. How can I make the mousedown event fire only if user has holded mouse down for 1 second for

ng-touchstart and ng-touchend in Angularjs

限于喜欢 提交于 2019-11-30 17:24:55
I have an element which fires functions on ng-mousedown and ng-mouseup . However, It doesn't work on touch screen, is there any directive like ng-touchstart and ng-touchend ? There is a module for this: https://docs.angularjs.org/api/ngTouch But you can write your own directives for events too: <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.js"></script> </head> <body ng-app="plunker"> <div ng-controller="MainCtrl"> <div my-touchstart="touchStart()" my-touchend="touchEnd()"> <span data-ng-hide="touched">Touch Me ;)</span> <span data-ng

WPF: Canvas swallowing MouseDownEvent?

大憨熊 提交于 2019-11-30 09:35:46
问题 Can anybody please explain to me why the MouseDown event is not reaching the ScrollViewer in this easy example? <Window x:Class="MouseDownTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ScrollViewer Name="scrollViewer" Background="Green" MouseDown="ScrollViewer_MouseDown" PreviewMouseDown="ScrollViewer_PreviewMouseDown"> <Canvas Name="canvas"

How to draw and move shapes using mouse in C#

这一生的挚爱 提交于 2019-11-30 07:34:31
I'm new to programming in C# and wanted to ask for a little bit of help. I'm currently trying to move a color-filled rectangle that I draw on a Windows Application form with my left mouse button, and I'm trying to drag-and-drop it to another location using my right mouse button. Currently I've managed to draw the rectangle, but the right click is dragging the entire form along. Here's my code: public partial class Form1 : Form { private Point MouseDownLocation; public Form1() { InitializeComponent(); this.DoubleBuffered = true; } Rectangle rec = new Rectangle(0, 0, 0, 0); protected override

Can't get Three.js onDocumentMouseDown to work correctly

房东的猫 提交于 2019-11-29 18:04:10
I've looked at a lot of examples -- and borrowed from some -- and can't seem to get this to work right. What I want is for the raycaster in onDocumentMouseDown to pick up sprites when the user clicks anywhere on the visible surface of a sprite. What I'm getting is a misaligned result, in that a sprite may be picked up if the user clicks somewhat to the right, above, or below the sprite, and will not pick it up at all if the user clicks on the left edge of the sprite. So basically something is misaligned, and I am at a loss for figuring out what I am doing wrong. Any guidance would be