mousemove

Hiding the mouse cursor when idle using JavaScript

倖福魔咒の 提交于 2019-12-05 02:13:19
Is it possible to use JavaScript to set the cursor attribute to the property none if the mouse is inactive for a certain amount of time (say, five seconds) and set it back to auto when it becomes active again? EDIT: I realize that none is not a valid value for the cursor property. Nonetheless, many web-browsers seem to support it. Furthermore, the primary user for this is myself, so there is little chance of confusion arising as a result. I've got two scripts that can do something similar: window.addEventListener("mousemove", function(){ document.querySelector("#editor").style.background = "

Make jQuery Tipsy tooltip move with mouse

时间秒杀一切 提交于 2019-12-05 01:02:01
问题 I'm sure this is possible -- and probably very easy -- but I can't figure out how to make it work. How can I make a Tipsy tooltip move horizontally along with the mouse? When hovering over a Tipsy-enabled element, I want the tooltip to appear at its normal Y position (directly above the element), but instead of having the X position fixed at the center of the element, I want it to be equal to the mouse's X position . To complicate things a bit, I'm trying to have the mousemove function

Jerky horizontal scroll on hover

筅森魡賤 提交于 2019-12-04 21:34:09
I'm using the following JS code to build a horizontal image carousel that scrolls on hover. The mousemove event detects the position of the mouse over the container and scrolls to the left or to the right accordingly. Everything works as I expect but if I move the mouse over the container while the animation is running, it becomes a bit jerky. Is there any solution for this? Thanks JS: $( '.carousel-frame ul' ).mousemove( function(e) { var container = $(this).parent(); if ((e.pageX - container.offset().left) < container.width() / 2) { var direction = function() { container.animate({scrollLeft:

how to implement mousemove while mouseDown pressed js

时光怂恿深爱的人放手 提交于 2019-12-04 21:32:25
问题 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'); }); 回答1: Use the mosemove event. From mousemove and mouseover jquery docs: The mousemove event is sent to an element when the mouse pointer moves inside the element. The mouseover event

How do I get my image to follow my mouse?

情到浓时终转凉″ 提交于 2019-12-04 19:55:23
How do I get my image to follow my mouse anywhere on the screen? The below code makes the image move along the x axis. import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; public class PlayerTwo implements KeyListener, MouseListener, MouseMotionListener{ public static int PLAYER_HEIGHT = 15; public static int PLAYER_WIDTH = 15; private Image p2Image = null; private static int x = 0; private static

Is it possible to put the mouse cursor behind an element or does the mouse cursor have an z-index?

妖精的绣舞 提交于 2019-12-04 12:22:24
I would like to replace the mouse cursor with an custom image when the mouse hovers over a certain element. I do it by setting the mouse curser off first with cursor: none; when it hovers the element. Then I read out the cursor position on the hovered element and set the css position of a graphic to the cursor position with a slight offset, so that the mouse curser is not over the graphic but still over the hover area. I made a fiddle here: http://jsfiddle.net/TimG/6XeWK/ Now it works quiet allright. The problem is just when you move the mouse very fast, the mouse cursor leaves the hover area

Jquery mousemove() gets activated without a mouse movement

天涯浪子 提交于 2019-12-04 11:50:25
I am trying to do a google.com like fade in (Cept i want to fade out text) <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> $(document).ready(function() { $("html").mousemove(function () { $("p").fadeOut("slow"); }); }); </script> With that code, my fade out gets automatically activated although I have not moved the mouse. Happens in all browsers. Any tips? Since the event fires once initially and mousemove fires every time you move it a pixel, you could just ignore the very first (possibly automatic, depending on browser) mousemove event to get the effect you want,

Prevent WPF ListBox from selecting item under mouse when layout changes

浪尽此生 提交于 2019-12-04 11:14:43
If a WPF ListBox gets a MouseMove event while the mouse button is held down, it will change the listbox's selection. That is, if you click the mouse on item #1, and then drag over item #2, it will deselect item #1 and select item #2 instead. How can I prevent this? That's the short version. The slightly longer version is this: When the user double-clicks an item in my ListBox, I make other changes to my layout, which includes showing other controls above the ListBox. This moves the ListBox downwards, which means the mouse is now positioned over a different ListBoxItem than it was when the user

Make jQuery Tipsy tooltip move with mouse

妖精的绣舞 提交于 2019-12-03 17:21:33
I'm sure this is possible -- and probably very easy -- but I can't figure out how to make it work. How can I make a Tipsy tooltip move horizontally along with the mouse? When hovering over a Tipsy-enabled element, I want the tooltip to appear at its normal Y position (directly above the element), but instead of having the X position fixed at the center of the element, I want it to be equal to the mouse's X position . To complicate things a bit, I'm trying to have the mousemove function enabled ONLY for elements that have a gravity of 2 characters ('nw', 'ne', 'sw', 'se'). No code to post, as

Simulate a physical mouse move in Mac OS X

半世苍凉 提交于 2019-12-03 12:51:11
I'm looking for a way to simulate a mouse move event in Mac OS X 10.6. It would have to be defined in mouse units (rather than pixels — that is important!) I need this for an experiment which basically consists of drawing lines. Any ideas are welcome. Thank you! One of the easiest ways to move the mouse in Mac OS X and other operating systems is to use a Java Robot . It can also simulate other events. For example, the mouse down or even a key press. However, it moves the pointer to a given screen coordinates. So the only thing you need to do is to convert your physical units into appropriate