Skip to content

Instantly share code, notes, and snippets.

@gamanox
Created March 13, 2013 19:03
Show Gist options
  • Save gamanox/5155073 to your computer and use it in GitHub Desktop.
Save gamanox/5155073 to your computer and use it in GitHub Desktop.
RotateY div on mousemove jquery
$(".cont_360").mousemove(function(event) {
var msg;
var mX = event.pageX;
msg = event.pageX + ", " + event.pageY;
console.log(msg);
if(mX<fullW/2){
var speed = (mX/(fullW/2))*1000;
setTimeout(function(){
$(".strip").css({ rotateY: '-='+1 });
}, 1100-speed);
}
if(mX>fullW/2){
var speed = ((mX-(fullW/2))/(fullW/2))*1000;
setTimeout(function(){
$(".strip").css({ rotateY: '+='+1 });
}, 1100-speed);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment