I'm trying to make elements on my site take off and fly off on a scroll.
This is the effect I'm looking for.
http://nizoapp.com/
The effect on nizo site is done using jquery, I think
I tried many different ways to make this effect work: Skrollr, scrollorama and jquery animate, as well as css transitions, etc. etc.
I decided to use css transitions as crazy "css animation cheat sheet" (google it)
After a lot of effort and some borrowed code, I have half the work, as in it I can get elements for entry on the scroll down, but not to fly back on the scroll.
This is jsfiddle with his half work
http://jsfiddle.net/mrcharis/Hjx3Z/4/
The code...
function isScrolledIntoView(elem) { var docViewTop = $(window).scrollTop(); var docViewBottom = docViewTop + $(window).height(); var elemTop = $(elem).offset().top; return ((elemTop <= docViewBottom) && (elemTop >= docViewTop)); } $(window).scroll(function () { $('.box').each(function (i) { if (isScrolledIntoView(this)) { $(this).addClass("slideRight"); } }); });
I tried to use another function (piece of code) to check if the scrollbar scrolls up or up, but I cannot get it to work with existing code.
Any help to get this job would be awesome
A good day
I will send the solution one day, if I can understand it, of course, someone else would like to know