Questions tagged [onmousedown]

onmousedown is the event where a mouse button is first clicked (as opposed to when the button is subsequently released, which is onmouseup). This is not specific to any language, so please also include a language tag if applicable.

Most questions with this tag relate to the HTML DOM event, and you can find further information here: https://en.wikipedia.org/wiki/DOM_events#Events

This event is common across many platforms however so you may need to seek additional references.

208 questions
57
votes
9 answers

JavaScript How to Dynamically Move Div by Clicking and Dragging

Okay it would seem like it should be simple. I need to take an already existing div and move it according to mouse position within the window. I have searched everywhere and it has led me to over-complicated ways of doing the same thing and involves…
StoneAgeCoder
  • 923
  • 1
  • 7
  • 13
41
votes
2 answers

How to implement an onmousedown and onmouseup on an iPhone touch screen

I've very new to HTML/JavaScript but am learning… I want to make a button on an iPhone that runs a JavaScript command when it is pressed and another when it is released. I tried to do this using onmousedown and onmouseup properties, but this does…
user3175352
  • 411
  • 1
  • 4
  • 3
40
votes
4 answers

does mousedown /mouseup in jquery work for the ipad?

I am using the current code: $('body').mousedown(function() { $('div#extras').fadeTo('fast', 1); }); $('body').mouseup(function() { $('div#extras').delay(2000).fadeTo(1500, 0); }); This works great in safari but when I upload it…
Annie
  • 1,391
  • 2
  • 10
  • 11
17
votes
1 answer

Downsides of onMousedown vs. onClick?

I've been dealing with a bane-of-my-existence Javascript problem involving tracking when a user clicks on a link (in case you're curious, here it is: Why does using target="_blank" cause Javascript to fail?). I've figured out that I can solve the…
Jack7890
  • 1,311
  • 4
  • 19
  • 27
16
votes
1 answer

mouseover while mousedown

I have a large table with with each cell being 25x25 and a div inside each one. Each div has the class of "node" and a background colour is applied to them all. I'm in the process of writing some jQuery code that will change the colour of each div…
Stanni
  • 717
  • 4
  • 10
  • 24
11
votes
2 answers

Simple pure Javascript drag controller slider

Hi Developers all over the world. I would like to have some help with a simple, pure Javascript (30 lines), JQuery free (and other library's) drag control slider. I have been searching months and found many scripts but i don't like -Jquery cause…
Stone Pentecost
  • 270
  • 1
  • 2
  • 11
8
votes
2 answers

Detect if I'm clicking an element within an element

I have an element (let's say div with id "Test") with a set height and width. Randomly placed within this element are other (smaller) elements (let's say id's "inner1","inner2","inner3"), but there is also whitespace, space where no elements are. I…
Tobias Hagenbeek
  • 1,212
  • 3
  • 15
  • 30
8
votes
4 answers

Use onmousedown to get the ID of the element you just mousedowned on?

Is this possible? I am attempting to write a function for onmousedown that will return the ID of the element you just clicked for later use in recreating that element in a different div.
Chris Sobolewski
  • 12,819
  • 12
  • 63
  • 96
7
votes
2 answers

Delphi - moving overlapping TShapes

I've needed own triangle shape so, I inherited my triangle class form TShape and override paint method. Everything works fine, but I need to move this shapes with mouse. I set the method for every shape handling onMouseDown event. Moving work also…
uiii
  • 469
  • 1
  • 7
  • 19
6
votes
3 answers

Mousedown event firing twice (WPF)

I am currently trying to capture a mousedown from an image on a simple grid. I have no problems with the event firing, it is just that it fires twice. And because clicking it twice will eventually have a different state (it will show an expanded…
Angelus
  • 71
  • 1
  • 4
6
votes
1 answer

Cannot catch all clicks when using onmousedown, onmouseup and click events

I'm trying to create a custom button out of a TPanel component. For this, I have provided an override for the onmousedown and onmouseup events (to do some drawing), and I've used the onclick event to handle the clicks. Unfortunately, if I rapidly…
Joe
  • 65
  • 3
5
votes
4 answers

onmousedown - left or right?

First of all, I am not looking for jQuery solution, just simple pure Javascript code, inside of an element. Let's say we have following html code: I want a simple script inside of the element to show popup…
Ωmega
  • 42,614
  • 34
  • 134
  • 203
5
votes
1 answer

Safari Only CSS Hover Event Not Triggered on Drag

There seems to be something wrong with Safari registering the hover event with css. If you run the snippet below and drag the cursor from blue to green, two things should happen. On all browsers, the green div will turn red on hover. On non-Safari…
Gregory Ling
  • 185
  • 15
4
votes
2 answers

IE9 Mousemove event not firing during Mousepress

When I left-click and drag the mouse, IE9 doesn't recognize the mousemove event. I need to know where the mouse is located while it is being moved during it's depressed state. Other browsers are working great. Here is the essence of my…
gcdev
  • 1,406
  • 3
  • 17
  • 30
4
votes
2 answers

prevent mousedown function when scrollbar used

I've got a div that shows onclick for a link and I want to hide when the mouse is clicked outside the div (similar to most modal box functionality) - the problem is that when the user uses the browser scrollbar, that is considered a click and hides…
GrandVizier
  • 499
  • 7
  • 19
1
2 3
13 14