mousemove 相关问题

有关设置,订阅或处理mousemove事件的问题。

如何编写一个苹果脚本,让鼠标空闲后移动到某个位置?

我正在寻找一种在 MacBook 上闲置一段时间后移动鼠标的方法,由于某些限制,操作系统中的空闲设置无法访问,某些移动鼠标的软件也无法访问

回答 1 投票 0

可移动/可拖动<div>

这是我更新和修改的脚本,它完全可以工作,除了我想通用它......观察****我怎样才能做到这一点,这样我就不必执行 function(e){ BOX.Draggable.elemen...

回答 9 投票 0

addEventListener mousemove 及其事件参数的正确打字稿类型是什么?

问题:在不使用任何内容的情况下,我的 onMouseMove 函数的正确输入是什么? 导出类主要{ 私有 dTimer:数字; 构造函数(){ this.init(); } 私有初始化() { 这个。

回答 4 投票 0

您好,我正在编写一些代码来调整无边框表单的大小,但结果是错误的。我找不到问题出在哪里

当我尝试运行此代码时,输出的行为是意外的,我认为代码是正确的。 如果有人有一些见解请帮助我解决这个问题。 我尝试过调整鳕鱼...

回答 1 投票 0

使用javascript在mousemove上移动网格画廊

我使用 html CSS 和 javascript 创建了这个项目。这个项目是关于移动与 mousemove 交互的网格画廊。我想做这个项目,但我不明白为什么不做

回答 1 投票 0

C# 以大于显示器分辨率的分辨率跟踪鼠标移动

问题 我正在使用 C# 应用程序来记录键盘和鼠标移动,处理该移动并将串行数据发送到微控制器,该微控制器解释该数据并移动一组...

回答 1 投票 0

Mousemove 事件未在页面元素或文档上触发

我正在尝试使用 js slider slick,但是当我在网站上包含滑块代码时,默认的“可拖动”选项不起作用。更具体地说,我无法捕获屏幕上的任何鼠标移动事件...

回答 6 投票 0

单击时用鼠标左右移动按钮

当我按住 btnn 类的按钮并向左和向右移动鼠标光标时,我希望按钮移动(向左和向右),并在释放鼠标光标时停止移动。 当我按住类 btnn 的按钮并向左和向右移动鼠标光标时,我希望按钮移动(向左和向右),并在释放鼠标光标时停止移动。 <div class="box1 d-flex flex-column justify-content-between h-100"> <div class="target d-flex gap-3"> <div class="block1"> <div class="square1"></div> <div class="square1"></div> <div class="square1"></div> </div> <div class="block1"> <div class="square1"></div> <div class="square1"></div> <div class="square1"></div> <div class="square1"></div> <div class="square1"></div> </div> <div class="block1"> <div class="square1"></div> <div class="square1"></div> <div class="square1"></div> </div> </div> <div class="Targeter"> <div class="btnn"></div> </div> </div> const moveButton = document.getElementById('moveButton'); let isMouseDown = false; moveButton.addEventListener('mousedown', () => { isMouseDown = true; moveButton.style.cursor = 'grabbing'; }); document.addEventListener('mouseup', () => { isMouseDown = false; moveButton.style.cursor = 'grab'; }); document.addEventListener('mousemove', (event) => { if (isMouseDown) { moveButton.style.left = `${event.clientX - moveButton.clientWidth / 2}px`; moveButton.style.top = `${event.clientY - moveButton.clientHeight / 2}px`; } });

回答 1 投票 0

鼠标事件未触发

我正在制作一个 C# WinForms 应用程序。由于某种原因,表单的 MouseMove 和 MouseClick 事件没有被触发。 (当我发现原因时,我可能会觉得自己像个白痴。) 这是一个

回答 3 投票 0

删除打印语句会影响功能...正在发生损坏?

我编写了一个java程序,当移动到屏幕的下部时,它将最小化窗口。它通过使用 Robot 将鼠标移动到最小化按钮并使用 mousePress 按下它来执行任务...

回答 1 投票 0

在 QGraphicsScene 类中跟踪鼠标移动

我对 QGraphicsScene 进行了子类化,并添加了 mouseMoveEvent 方法来处理鼠标移动事件。 我在 QGraphicsView 顶部创建了一个标尺,并让标尺跟踪鼠标移动。在 QGraphicsScene 中::

回答 2 投票 0

跟随鼠标移动和滚动的元素

我正在尝试编写一些 Vanilla Javascript 来使元素跟随我的鼠标移动。我使用了 clientX、clientY 和 mousemove 事件来使其跟随,但是当我滚动页面时,el...

回答 2 投票 0

带有 Javascript 的浏览器内屏幕保护程序

上下文:对于自助服务终端应用程序,出于脱离主题的原因(请参阅此处),我不依赖操作系统屏幕保护程序,而是在 JS 中实现屏幕保护程序:黑色模态层(全宽、全宽)高度)

回答 1 投票 0

GHUB LUa - 鼠标缓慢移动功能

我正在尝试在LUA(GHUB)中创建一个本地函数,将鼠标移动到屏幕上的特定坐标。 然而,指针在函数调用结束时突然移动......并且不会...

回答 1 投票 0

如何在 Chrome 中通过鼠标移动调整图像大小?

我编写了一个小脚本(JavaScript - jQuery),用于测试依赖于 mousemove 事件的图像调整大小操作。简而言之,想法是单击图像一次,然后拖动...

回答 1 投票 0

jQuery - 如何在 Chrome 中通过鼠标移动调整图像大小?

我编写了一个小脚本(JavaScript - jQuery),用于测试依赖于 mousemove 事件的图像调整大小操作。简而言之,想法是单击图像一次,然后拖动...

回答 1 投票 0

通过js设置顶部和左侧样式属性时出现奇怪的不一致错误

我创建了一个具有固定位置和大小的div元素。然后我通过 mousemove 事件处理程序中的 js 设置它的顶部和左侧样式属性。 const mouse = document.getElementById('mouse'); 窗户。

回答 1 投票 0

如何将鼠标垂直/水平位置转换为宽度(px)JavaScript?

动态更改鼠标位置后,我尝试将其转换为宽度像素,如果鼠标位于屏幕底部,则将其设置为 0px,如果鼠标位于屏幕的顶部框架,则将其设置为 100px...

回答 1 投票 0

获取鼠标移动速度

我没有从 stackoverflow 得到精确的解决方案/计算,所以我创建了一个问题 var 时间戳 = null; var mY = 0; $(文档).mousemove(函数(e) { var now = Date.now(); 当前mY = e。

回答 2 投票 0

启用/禁用鼠标移动功能

我有两个按钮。当我单击第一个按钮时,我的“d”和“bg”元素会随着鼠标移动而移动。 我有两个按钮。当我单击第一个按钮时,我的“d”和“bg”元素会随着鼠标移动而移动。 <section> <div class="d"></div> <div class="bg"></div> </section> <div class="button1"></div> <div class="button2"></div> $('.button1').click(function(){ $('section').delay(2500).mousemove(function(e) { parallaxIt(e, ".d", -12.5); parallaxIt(e, ".bg", -3.75); }); }); function parallaxIt(e, target, movement) { var $this = $('section'); var relX = e.pageX - $this.offset().left; var relY = e.pageY - $this.offset().top; TweenMax.to(target, 1, { x: (relX - $this.width() / 2) / $this.width() * movement, y: (relY - $this.height() / 2) / $this.height() * movement }); } 我希望当我单击第二个按钮时,元素不再移动。 我先尝试了解除绑定的方法: $('.button2').click(function(){ $('section').unbind('mousemove'); }); 这样,我的问题是,当鼠标移动停止时,我的元素不会在原来的位置完成,而是突然停留在停止时的位置。 不知何故,如果有适合我的方法,我更喜欢这种方法。 第二种方法是关闭方法: $('.button2').click(function(){ $('section').mousemove(function() { $('.d, .bg').off("mousemove", mouse); }); }); 我的问题是单击后它根本不会停止鼠标移动。 也许知道我使用 jQuery v1.11.0 很重要。请给我一个简单的答案,因为我做网页设计是出于爱好,主要是为了我自己的个人网站或给朋友,所以我不专业。 // Initialize a variable to track whether the mousemove effect is active var isMousemoveActive = false; // Function to reset the elements' positions to their original state function resetPositions() { // Use TweenMax to smoothly reset positions TweenMax.to(".d, .bg", 1, { x: 0, y: 0 }); } // Button 1 click handler $('.button1').click(function () { // Start the mousemove effect isMousemoveActive = true; // Attach the mousemove event to the section $('section').mousemove(function (e) { if (isMousemoveActive) { // Apply parallax effect parallaxIt(e, ".d", -12.5); parallaxIt(e, ".bg", -3.75); } }); }); // Button 2 click handler $('.button2').click(function () { // Stop the mousemove effect isMousemoveActive = false; // Detach the mousemove event from the section $('section').off('mousemove'); // Reset the positions of .d and .bg elements resetPositions(); }); // Function to apply parallax effect function parallaxIt(e, target, movement) { var $this = $('section'); var relX = e.pageX - $this.offset().left; var relY = e.pageY - $this.offset().top; // Use TweenMax to smoothly apply the parallax effect TweenMax.to(target, 1, { x: (relX - $this.width() / 2) / $this.width() * movement, y: (relY - $this.height() / 2) / $this.height() * movement, }); }

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.