Background image move with cursor problemo

I followed it nearly to a tee…all that is different is the class name. Someone please help me get the effect… I followed this tutorial. I don’t get any errors on chrome so I really don’t know whats up!!
tutorial i was following


The js panel in codepen should only contain js and not script tags as script tags are html. Also the link to jquery should preferably be in the js settings panel in codepen although you could have added all the scripts in the html panel at the bottom.

You also copied the code before it was working as this is the updated rules (at 4.15 in the video) that should go in the JS panel in codepen (no script tags needed).

$("main").mousemove(function (e) {
  var moveX = (e.pageX * -1) / 15;
  var moveY = (e.pageY * -1) / 15;
  $(this).css("background-position", moveX + "px" + " " + moveY + "px");

Then add the link to jquery in the settings panel or add it at the bottom of the html.

1 Like

Don’t know whether to be happy or sad but im happy you exist. Thank you!!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.