I have an object that I want to spin whenever the user scrolls the page and that object is currently in view.
So if my object is right in the middle of the page when the site is first loaded, I want it to spin "right" when the user scrolls down. When the user scrolls up, it will spin "left".
I can't figure out how to make it spin whenever the object is in view, not just when the top of the view is hit with the object. I am using jQuery Waypoint to detect scrolling, and jQuery Transit to animate my object. :
$('#home-spinner').waypoint(function (event, direction) {
console.log("Waypoint moved "+direction);
if(direction==='down'){
$("#home-spinner").transition({ rotate: '+180deg' },1000,'ease');
}
if(direction==='up'){
$("#home-spinner").transition({ rotate: '-180deg' },1000,'ease');
}
});