mousemove

How to properly scroll an overflowing div based on mouse position within its container

陌路散爱 提交于 2019-12-06 20:40:33
I am working on a small jQuery plugin that autoscrolls through a set of overflowing elements within a container div based on the mouse position within that container div. See the Demo Here The idea is for this plugin to be an improvement of something I wrote a while ago. See the autoscrolling navigation in the lower left here The old problem with this was that it jumps around when you mouseenter from anywhere but the bottom(javascript perspective) of the container div. Now everything is working fine with my plugin but when you mouseenter from the top it screws up from time to time(move your

How can I access an iframes document event mouse position from the parent window using javascript and or jquery

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 09:59:18
I have an iframe inside of a parent window, with both the iframe src and the parent located in the same domain. In order to keep the iframe document clear of javascript I want to be able to use a function in the parent window to get the the mouse position inside the iframe. My attempts at this so far have included: <iframe id="iframe1" src="test.html" style="position:relative; width:500px; height:500px"></iframe> <div id="result" style="border:1px solid black"></div> <script> $(document).bind("mousemove", function(e){ $("#result").html("x:" + e.pageX + ", y:" + e.pageY); }); $("#iframe1")

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

最后都变了- 提交于 2019-12-06 07:49:34
问题 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

Jquery mousemove() gets activated without a mouse movement

谁说胖子不能爱 提交于 2019-12-06 07:33:20
问题 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? 回答1: Since the event fires once initially and mousemove fires every time you move it a pixel, you could just

javascript use drag to move element

烂漫一生 提交于 2019-12-06 05:40:01
How does one set the position of an element? When the user drags an element (an image), I'd like to have it move synchronously. I see that my "mousemove" handler is being called. However I cannot get the element to actually move. Here's the mousemove handler (the element being dragged is "overlay"): function handleMouseMove (event) { var deltaX = event.movementX; var deltaY = event.movementY; var divOverlay = document.getElementById ("overlay"); var rect = divOverlay.getBoundingClientRect(); divOverlay.style.left = rect.x + deltaX; divOverlay.style.top = rect.y + deltaY; } Here's the html for

How to track mouse movements without limiting it to screen size?

筅森魡賤 提交于 2019-12-06 03:13:50
I'm using WM_MOUSEMOVE to get changes in mouse position. When simulating "knobs" for example it's desired to let the user go up/down with mouse without any limits. In this cases I hide cursor and use SetCursorPos to change its position every time user moves with it and detect just the difference from the original position. Unfortunately it doesn't seem to work - if I set the mouse position, it sometimes works, but sometimes is one or more pixels away, which is just wrong. And even bigger trouble is that after the call another WM_MOUSEMOVE seems to be delivered, which unfortunately does the

Java robot class mouseMove not going to specified location

为君一笑 提交于 2019-12-05 16:24:30
To be honest I am not entirely sure what is wrong. This is the short version of a ton of other basic robot command movements under the if and if else. Whenever I run the program the mouse should move to the designated position and click. However when I run the program it does not move to the position I indicated, instead it moves to a different position each time I run it(I do not have any listeners designated to change the position so the position shouldn't be changing). I do not know if it is something with the code I have written itself or possibly my imports? The program was running

-mouseMoved OSX does not get called in a sprite kit SKScene

余生长醉 提交于 2019-12-05 16:21:50
The following responder (defined in NSResponder) does not get called in an SKScene in OSX: -(void) mouseMoved:(NSEvent *)theEvent { DLog(@"TEST"); } I have said the window to accept mouse moved events in the app delegate. _window.acceptsMouseMovedEvents = YES; Thank you in advance. SOLUTION: Add to the app delegate: _window.acceptsMouseMovedEvents = YES; [_window makeFirstResponder:self.skView.scene]; Add to the app delegate: _window.acceptsMouseMovedEvents = YES; [_window makeFirstResponder:self.skView.scene]; In swift window.acceptsMouseMovedEvents = true; window.makeFirstResponder(self

Clicking on given coordinates of element in protractor

ⅰ亾dé卋堺 提交于 2019-12-05 16:10:24
问题 I want to click on a specific location of my canvas element, so I wrote the following Protractor code: var canvas = element(by.id("canvas")); var clickCanvas = function(toRight, toBottom) { browser.actions() .mouseMove(canvas, -toRight, -toBottom) .click(); } toRight / toBottom are the numbers of pixels where the click should be made, relative the top left corner of my canvas. However, the click does not seem to be executed at the given coordinates. I got the snippet from a related question

jquery mousemove how to stop

 ̄綄美尐妖づ 提交于 2019-12-05 14:47:40
I have this fiddle http://jsfiddle.net/JqBZb/193/ where I want my object to move only when the red square is pressed, but I cannot remove the mousemove action when the user releases the mouse. It still moves after that. HTML: <div class="pointer"> <div class="marker"></div> </div> CSS: .marker { background:#ED1C24; height:2px; right:0; position:absolute; top:35px; width:7px } .pointer { height:72px; position:absolute; top:82px; width:72px; border:1px solid red; left:100px; } JAVASCRIPT: var img = $('.pointer'); var offset = img.offset(); function mouse(evt) { var center_x = (offset.left) +