Skip to content

Instantly share code, notes, and snippets.

@mosquito
Created September 1, 2014 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosquito/841767d80d22f81532c5 to your computer and use it in GitHub Desktop.
Save mosquito/841767d80d22f81532c5 to your computer and use it in GitHub Desktop.
(function(a){a.Parallax=function(c,a){(a||c)[0].onmousemove=function(a){c.each(function(d){var b=$(this);d=b.data("depth")?parseFloat(b.data("depth")):1;var c=b.data("ratio")?parseFloat(b.data("ratio")):50,b=-((a.pageX+this.offsetLeft)/(c*d));d=-((a.pageY+this.offsetTop)/(c*d));$(this).css("background-position",b+"px "+d+"px")})}}})(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment