📜  如何使背景图像移动 mmousemove jquery - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:04.106000             🧑  作者: Mango

代码示例1
how to make background image move mmousemove with jquery:
$('background-section').mousemove(function (e) {
  // values: e.clientX, e.clientY, e.pageX, e.pageY
  // console.log(moveX = (e.pageX));
  let moveX = (e.pageX * -1 / 20);
  let moveY = (e.pageY * -1 / 15);
  $(this).css('background-position', moveX + 'px ' + moveY + 'px');
});