FAQ Database Discussion Community


jquery : animate list scrollLeft/scrollRight on mouse wheel

javascript,jquery,scroll,mouseevent
I have the following code to scroll left/right when user use mouse wheel. Event is well binded because i go to the JS code when the user try to scroll, but the code has never effect. <div id="contact_list"> <ul id="contact_list_ul"> <li>img1</li> <li>img2</li> <li>img3</li> <li>img4</li> <li>img5</li> <li>img6</li> <li>img7</li> <li>img8</li> <li>img9</li> </ul>...

Retrieve the index ul li a list

javascript,jquery,html,javascript-events,mouseevent
I have a list which, when clicked, gives me its index. The problem I have is that the first time I click, it does not do the action in its entirety. I have to re-click on it and then everything works perfectly. But I can not find the problem. Can...

jquery enable :hover of div on other div mousover

jquery,hover,mouseevent,mouseover
I need TOGGLE :hover action of specific div, but also when mouse cursor is over other DIV <div class="ms-thumb"> <div class="ms-product-thumb"> <div class="ms-thumb-hover"> .ms-thumb-hover </div> </div> <div class="ms-thumb-desc"> on this mouseover: make '.ms-thumb-hover' red! </div> </div> jQuery <script> $('.ms-thumb-desc').hover(function(){ $('.ms-thumb-hover').hover(); }); </script> Here is Fiddle : http://jsfiddle.net/u4a1z3d2/3/ Explain please why...

Transform translation and e.pageX/e.pageY coordinates differ

canvas,mouseevent,transform,translate
When I apply a translation (transform: translate...) on a canvas and I check its position on the Chrome Windows with e.clientX and e.clientY, I get different values. The same applies to the width of the canvas, it is different with e.clientX and e.clientY than the actual width value in the...

Mouse Proximity to object Javascript

javascript,canvas,mouseevent
I'm struggling with this for a while now. I'm drawing a grid on the canvas. I add a mousemove eventHandler and track the mouseX and mouseY positions. I would like to be able to calculate the distance from the mouse position to the item in the grid. I can't seem...

Best way of attaching event listener to the whole html document

javascript,jquery,html,dom,mouseevent
Let's consider the problem of capturing mousemove on the whole HTML document. I know four objects to which event listener can be attached: window, document, document.body, document.documentElement After simple tests it seemed to me that attaching to any of them has the same effect. $(window).on('mousemove', function(){console.log(1)}) I was wondering if...

Bootstrap accordion doesn't always collapse on Google Maps listener event

javascript,jquery,google-maps-api-3,twitter-bootstrap-3,mouseevent
How do you get the Bootstrap accordion to show (i.e. smoothly "unroll" itself) only when pointer hovers over a Google map, and hide (i.e. smoothly "collapse" itself) when it leaves the map? I attach the .collapse('show') to mousemove event, and .collapse('hide') to mouseout, but this works only when the pointer...

how to see mouseReleased() event outside canvas using processing.js

mouseevent,processing,processing.js
I have an object I want to drag around the screen with the mouse in Processing. I set acquired to true on mouse down over the object, and to false on mouse up, thus: void mousePressed() { if (overThing()) { acquired = true; } } void mouseReleased() { acquired =...

Send ajax request on mouseover

javascript,jquery,ajax,mouseevent
I have a set of element with the same class selector. When I enter mouse on this element I want to send Ajax query, but. When I just console.log(1); on mouse enter all fine, but when I send request it rise in some progression, and each next hover send many...

mouse position and give the position color

c#,visual-studio-2010,mouseevent,pixels
How can I get the color of a pixel at the location of the cursor? I know how to get the mouses position using MousePosition but I can not figure out how to get the pixel color at that location. I write the code put I have no result when...

Java Swing Clickable JFree Charts, clicked each bar chart or pie chart to open new frame or new charts

java,swing,mouseevent,jfreechart,desktop
I am making a desktop application based on java swing for my final year project. I have created different types of charts which is connected from my database. Now would like to make this dashboard more interactive and when click on the each bar i want to drill down further...

Qgraphicsview items not being placed where they should be

python,mouseevent,pyqt4,qgraphicsscene
I recently created a program that will create QgraphicsEllipseItems whenever the mouse is clicked. That part works! However, it's not in the exact place where my cursor is. It seems to be slightly higher than where my mouse cursor is. I do have a QGraphicsRectItem created so maybe the two...

Store two mouse click positions on canvas when checkbox enabled

c#,wpf,canvas,checkbox,mouseevent
I have a checkbox at the moment where, when I click it, it should allow the user to click two places on a canvas, and then a messagebox with the coordinates of both clicks appear, and then the checkbox should uncheck itself. I've tried various things and keep running into...

Mouse press event called twice

mouseevent,processing
The following code is not working properly, what i want to happen is to call the placing_shapes_in_screen function with a mouse press and then wait for another press to place an object on the screen, however what is actually happening is that the first key press is registering twice!! please...

C#, WinForms, waiting for timers

c#,while-loop,mouseevent,system.timers.timer
Trying to understand Timers and virtual clicks in C# Winforms. I want to have the program have an entered time value by the user (textbox1), then wait that amount of time and click the mouse, then increase the number counter (textbox2). In the code below, the number counter immediately goes...

OnMouseDown on box collider 2D not firing

c#,unity3d,mouseevent
I have an empty gameobject on my scene with a component box collider 2D. I attached a script to this game object with : void OnMouseDown() { Debug.Log("clic"); } But when i click on my gameobject, there is no effect. Do you have any ideas ? How can i detect...

My MouseHook is blocking the hook notifications of other applications

.net,vb.net,winapi,mouseevent,hook
I've implemented an LL mouse hook that captures when the mouse receives movement if the mouse is moving on an specified area. The problem is that when my mouse hook is active, it blocks the hooks of other applications, other applications that tries to catch mouse events. Like for example...

how to avoid mouse event conflict with timer

jquery,hover,mouseevent,setinterval
My goal is to hover an element on a webpage, in this case an li tag, causing a main image to swap with an alternate one. While the mouse hovers the li tag, the alternate image is to be visible. The alternate image is to remain visible for n seconds...

JLabel can't keep up with mouse

java,drag-and-drop,mouseevent
I have a small program, that creates a something, that could be considered a joystick. Everything works, but there is a glitch, I can't work out how to fix. If mouse moves too fast, the JLabel that I'm dragging around, sticks, as mouse has moved outside of the drawn box....

how to implement mousemove while mouseDown pressed js

javascript,jquery,mouseevent,mousemove,mousedown
I have to implement mouse move event only when mouse down is pressed. I need to execute "OK Moved" only when mouse down and mouse move. I used this code $(".floor").mousedown(function() { $(".floor").bind('mouseover',function(){ alert("OK Moved!"); }); }) .mouseup(function() { $(".floor").unbind('mouseover'); }); ...

Circle drawn in a JPanel does not get drawn at the position of mouseClick

java,swing,jpanel,mouseevent
I'm trying to create a program that lets the user move a circle in a JPanel, But I'm facing some problems. My program: import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.border.Border; import javax.swing.BorderFactory; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Color; import java.awt.Graphics; import java.awt.FlowLayout; import...

How to execute a function on mouse click on rectangle HTML5 Canvas

html5,html5-canvas,mouseevent
I'm looking for a simple way to execute a function when someone clicks on a rectangle inside an HTML5 Canvas. I would like to do it in a way that doesn't require any special libraries. Any suggestions?

mouse position (Cursor.Position)

c#,image,mouseevent,picturebox,pixels
I have image 10*10 mult it in factor and loading the image to picturebox I have problem to select the mouse position when I clicking in everywhere over the image the point showing in the corner Upper-left what is the error??

Draw same lines drawn on a Tkinter Canvas on an OpenCV image

python,opencv,tkinter,mouseevent
Using the mouse, I let the user to draw random curves on a Tkinter Canvas. These curves are drawn as short lines between points over which the mouse moves. My aim is to save the points used to draw the lines on the Canvas and to draw the same curves...

WM_LBUTTONUP is not received in my subclass procedure

listview,winapi,mouseevent
I am trying to catch the event when user releases left mouse button after clicking on listview. In the code below, I need to double click in order to get beep. The desired behavior is to get the beep as soon as the user releases left mouse button. Code speaks...

How to store and mark all mouse-clicked-point on an Image loaded in JPanel?

java,event-handling,jframe,jpanel,mouseevent
Up till now I have used the code given below to load image in a new new JFrame and coordinates of pixels of image are hard-coded in the code itself. However, I wish to do it dynamically i.e mark points clicked by mouse and store all the coordinates in an...

Trying to get just “x” coordinate from pos() method python

python,position,mouseevent,pyqt4
I'm currently having an issue getting just the x position of the cursor so I can place a marker on that x and y location. I'm using QGraphicsScene and view to create this circle object at the location of the mouse when the mouse is clicked. Since the QGraphicsEllipseItem takes...

SDL: how to get the mouse motion while the left mouse button is down using case statement

c++,switch-statement,mouseevent,sdl-2
I am currently working with SDL2 and am fairly new to it. I am trying to use case statments to get the mouse motion coordinates only while the left mouse button is pressed down. In the end, I need to be able to click on a object and find how...

Unity - How to write console

c#,unity3d,console,mouseevent
I add an AR camera my unity project. I use vuforia sdk for AR functions. I want to handle mouse/finger click on screen and get pixel position on screen image. I write below code. To check pixel values, I try to write them on the console. But I don't see...

setTimeout function not triggering on first mouseenter / hover

javascript,jquery,html,mouseevent,jquery-hover
Overview: I am creating a menu that shows a div 'showme' when you hover over a list item with class 'showhim'. I want a delay when switching between a list item so I included a setTimeout function. Problem: The setTimeout function is not being triggered on the first mouseenter event....

Trouble using mouseover on ad in Chrome extension

javascript,jquery,google-chrome-extension,mouseevent,ads
As part of a Chrome extension, I'm trying to detect when you hover on an ad. Right now, I'm only testing on the NYT frontpage. The problem area of the content script is as follows: $(document).ready(function (){ setTimeout(function() { console.log("starting..."); console.log(document.querySelectorAll("iframe")); var frames = $("iframe").contents().find(".ad-frame.frame-for-homepage"); console.log(frames); frames.on("mouseover", function(event){ console.log("on ad");...

Java - Access datas of a MouseListener from another Component

java,swing,jpanel,mouseevent,mouselistener
I'm currently working on a level editor for a game. Currently, to create an Entity, you have to click on a creation JButton, then a form appears, where you enter its coordinate and its size. I would like to implement a mouse fonction. The user click on the creation JButton,...

How I can use mouse events with Jquery

javascript,jquery,mouseevent
I'm tryng to configure the list of users in a chat adding the function slide something like this http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_slide_down Similar facebook, when mouse is over focus, the chat container is slowly hidden I'm using jquery-1.8.1.min.js in the proyect and have the principal container with a id and i can configure...

How to move an object with the mouse in c++?

c++,c,mouseevent,sdl
I have a problem trying to create a script that moves an object with the mouse. The object is supposed to move when I hold the mouse button (which button does not really matter, so let us leave it there. I use SDL, so I have no trouble implementing this)....

event.localX of a MovieClip regardless of any other DisplayObject over/under/inside

actionscript-3,mouseevent,gesture
Here is an example: var table:Table = new Table(); stage.addChild(table); //table covers the whole stage for (var i:int = 0; i<= 10; i++){ var book:Book = new Book(); book.x = Math.random() * stage.stageWidth; book.y = Math.random() * stage.stageHeight; if (Math.random() < .5){ stage.addChild(book) } else { table.addChild(book) } stage.addEventListener(MouseEvent.CLICK, clicked);...

how to avoid flickering on mouseenter event in jquery?

jquery,mouseevent,mouseenter,mouseleave
I don't know exact technical word for this but in following jquery code on 'mouseenter' and 'mouseleave' event the whole div get movement like button clicked (flickers?) and I also used 'mouseover' and 'mouseout' but same problem occurs. $total_doctors=mysql_fetch_array(mysql_query("select count(*) from doctor")); Main div: <div class='mainspan action-nav-button'> <a href='doctor.php'> <span>&nbsp;</span>...

VB.net : Wait a bit before right clicking

vb.net,cursor,mouseevent
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Me.Cursor = New Cursor(Cursor.Current.Handle) Cursor.Position = New Point(800, 500) 'mouse_event WaitFor2 seconds??? Cursor.Position = New Point(800, 500) mouse_event(&H8) Cursor.Position = New Point(800, 500) mouse_event(&H10) End Sub I am trying to make the cursor wait a few seconds before right-clicking. I've...

VLCJ Mouse Event Input for Video

jframe,mouseevent,vlcj
So I have read some old posts (from 2011) that Windows has an issue supporting mouse events while videos were playing and some Windows hooker had to be used. Then, I found a more recent post related to this issue here: https://github.com/caprica/vlcj/issues/78 At the end of this post, a method...

How to write a MouseListener for JavaFX

javafx,mouseevent,java-8,mouse,mouselistener
I want to write a little game where I schoot from an object to a specific direction on a JavaFX Panel using my mouse position. I want to turn a Line in the direction where my Mouse is. Line line = new Line(startPosX, startPosY, mouseDirectionX, mouseDirectionY); How can I do...

Mouse detection at many positions

java,swing,jpanel,mouseevent
I am using Java with Swing and I want to detect mouse clicks at a number of locations (~200) in the view. Should I use coordinates to ascertain where the click occurs (requiring searching through every location) or add multiple JPanels over each location and listen for mouse events for...

Detect whenever click event is fired in fully transparent window

c#,wpf,mouseevent
I have a transparent controls and window where I can click through as it would not even exist. My question is: Is it possible to detect whenever click event is fired no matter where on the screen I click, while the wpf applicaton is running? The reason why I need...

Play a frame of a Movieclip when MOUSE_OVER

actionscript-3,flash,mouseevent,mouseover
I have a map with different countries. When i hover over one of the countries, i want it to play a certain frame of a movieclip. I've made a movieclip for each country, which has 2 frames. The 1. frame is just the picture of the country like it appears...

How to get a right-click item which is not selected in Java Swing's list?

java,swing,mouseevent,jlist
I have a Java Swing Jlist, and I know how to process a left-click and right-lick on a "selected item", but my question here is : If item 1 is currently selected, but when I right click on item 3, how to get that item's info/identity ? For example, in...

Mouslistener causing problems

java,swing,mouseevent,mouselistener
I've have created a GoInvisible class in my code which implements a mouse listener, i'm tryna use the mouse pressed and the mouse released methods to get my frame to go transparent and then return to normal on the press and release of a button on the frame. i'm invoking...

How do i end an ongoing mouseevent in fabricjs

mouseevent,fabricjs
i am trying to achieve a collision detection with fabricjs. In the example i'm providing, the blue ball should not be able to cross the red line. The collision detection works fine, but i cant figure out how to end the dragging once the collision takes place. I tryed to...

Scroll and mouse event animated header

jquery,animation,scroll,mouseevent
I'd like my header to shrink on scroll, resize if it's moused over and return to being shrunk on mouse leave (if that's a grammatically correct sentence). My problem is that my noob code makes the header shrink on mouse leave even when the page hasn't been scrolled, and I...

How to detect mouse movement over node while button is pressed?

javafx,mouseevent
Problem You can add an event listener to a node which detects mouse movement over it. This doesn't work if a mouse button was pressed before you moved over the node. Question Does anyone know how to detect mouse movement while the button is pressed? So far I've only found...

JavaFX setting Button style on Mouse Click

java,css,button,javafx,mouseevent
I've got a problem with a Java project I'm working on: I'm creating a grid of buttons via code in javafx on a pane. The buttons are all types of a subclass of the javafx Button class that i wrote. Here's the header of the class: private final String BASIC_STYLE...

How to detect the user is using the Trackpad and not the mouse in Java swing?

java,swing,mouseevent,trackpad
I hava a Java swing application that use a 'pan-able' JComponent to display large data. When the user move the mouse wheel, I listen to these events, and update the content of the JComponent from the scrolled amount. I would like to have a different behavior depending on whether the...

In Unity3D/2D Mouse released outside is not possible?

unity3d,mouseevent
I am developing UI for my game. I started with simple Play button. When it is touched, the game will start, but if the user touches the play button and releases touch outside the play button nothing should be happen. How to implement such action. I tried with following code,...

In WPF how can I control whether another button clicked

c#,wpf,button,mouseevent
I want to determine another button is clicked in wpf. I wrote same code as below, when I clicked that button the animation works after that when I clicked same button the animation work like as else block. But I want to control if another button is clicked and than...

jQuery: How to detect if mouse click location is outside of a div

javascript,jquery,mouseevent,mousedown
I have this code which detects any mouse click on a website: $(document).mousedown(function() { console.log("you clicked somewhere."); }); How do I make it to only trigger an action if the clicked location is outside of #specificDiv?...

javascript jquery css event listeners

javascript,jquery,css,mouseevent,event-listeners
I'm reading JavaScript and JQuery by Jon Ducket and he makes it pretty clear that using HTML event handlers is bad practice (p. 250). In my sample project I'm just trying to change the color of a few divs based on mouseover, mouse out, and click. My friend says I...

Action Script 3.0 - MouseEvent Listener + function issues

actionscript-3,flash,actionscript,mouseevent
I'm working on a project that has multiple clickable objects on the stage. However, when I create the following function, I getting the last defined eventlistener . // Event listeners antwoordBox1.addEventListener(MouseEvent.CLICK, antwoordboxclick); antwoordBox2.addEventListener(MouseEvent.CLICK, antwoordboxclick); function antwoordboxclick(event:MouseEvent):void { trace (event.currentTarget.name); // traces 'antwoordBox2' , whether I click any of the buttons....

How to check if key pressed when clicked event in java

java,event-handling,mouseevent,keyboard-events
I want to catch the Clicked event in java when key pressed (not ctrl, or shift, or alt), or check if key "A" press druing key "D" pressed. How can i do that, something like the method isshiftdown ?

disable right click in javascript

javascript,onclick,mouseevent
When I was trying to disable the right click, it is not working. I tried with below code. document.onclick = function(e) { console.log(e.button); if(e.button == 2){ e.preventDefault(); return false; } } Based on below link only I tried. Disable Right Click in website I tested this code in Chrome and...

How to create a boolean local variable as a result of MouseEvent?

java,mouseevent,boolean-expression
I'm just starting to learn Java and I'm trying to correctly initialise 4 variables that come from a MouseEvent. I understand how to retrieve a click position, but I don't know how to create a boolean local variable, leftClicked, and initialize it to true if the left mouse button is...

Detect mouse clicks on circles on HTML5 canvas

javascript,html5,canvas,click,mouseevent
I'm new to canvas and I'm trying to listen to mouse clicks on the circles that I previously drew on canvas. I'm trying to change the colour of the circles (maybe to green) when I click on them. var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); var radius = 15;...

Restrict Mouse Movement while dragging

java,dialog,mouseevent
So I have created a JDialog, and I have programmed it to move when I drag it by setting this at the start of the program; Point point = new Point(); int xMouse; int yMouse; int x; int y; Dimension scrnSize = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle winSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); int taskBarHeight =...

dispatch mouse out event when the mouse not out

actionscript-3,events,tooltip,mouseevent,mouseover
I created a tooltip class. When the mouse over on MovieClip it enable and when it out it disable. The movieclip containt some other movieclips. My code is that: to.addEventListener(MouseEvent.MOUSE_OVER, showTip); to.addEventListener(MouseEvent.MOUSE_OUT, hideTip); to.addEventListener(MouseEvent.MOUSE_MOVE, MoveTip); and the functions is that: private function showTip(evt: MouseEvent) { if (tip != null &&...

Java Mouselistener not being added

java,swing,mouseevent,mouselistener
I've creating a new game class that is basically a GUI for my game. I'm wanting to add a mouselistener so that I can check when the user is clicking on different things. However, I'm struggling to get the basics working. Here is what I have so far. The game...

Click the mouse to continue python 2

python,mouseevent,mouse,rect
How can I continue the game when the player clicks on the mouse? I tried making a huge rectangle and then if rectangleRect.collidepoint(mousex,mousey): blablablabla I know for sure it can be done much easier, but I don't know how. Anyone got some suggestions?...

My QGraphicsItem items are not noticed by the mouse

c++,qt,graphics,mouseevent
I am trying to move my item... The only way this works is if I iterate through all my items and check the mouse position: class Item : public QGraphicsItem { Item() { setFlag(ItemIsMovable); setFlag(ItemIsSelectable); scale = 10; } QRectF boundingRect() const; void paint(QPainter *painter); // had to implement this...