Link to home
Start Free TrialLog in
Avatar of coolispaul
coolispaulFlag for United States of America

asked on

Move background image based on mouse position from right side of screen

Hi

Im moving a background image based on x mouse position with :

$("html").mousemove(function(e){
  var strength1 = 100;
  var pageX = e.pageX - ($(window).width() / 2);
  $('#foreground1').css("background-position", (strength2 / $(window).width() * pageX * -1));
}

Open in new window

this works fine with images on left. How can i adjust this for an image sat on the right of the screen?

Thanks
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Do you have a link we can look at?
ASKER CERTIFIED SOLUTION
Avatar of Sar1973
Sar1973
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial