简体   繁体   中英

How to change jquery knob value on mouse move?

我有一个jquery旋钮,其值在鼠标滚动时会更新。我希望在鼠标移动时完成更新。

You can implement a code like this:

var lastX;
var lastY;

$( "#container" ).mouseover(function() {
 $( "#target" ).mousemove(function( event ) { 
  var x = event.pageX;
  var y = event.pageY;
  /* here you add or subctract depens on compagin on lastX and lastY */
  /* at the end */
  var lastX = event.pageX;
  var lastY = event.pageY;
});
});

DEMO

You are probably searching for the .mousemove() function of jQuery.

Just make sure you apply it to the correct object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM