Answers for "how to make background image move mmousemove jquery"

1

how to make background image move mmousemove jquery

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');
});
Posted by: Guest on May-31-2020

Code answers related to "how to make background image move mmousemove jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language