animation - jQuery gallery scrolling effect with ease -
so, got page friend , think gallery amazingly done. bad it's in flash ; http://selected.com/en/#/collection/homme/
now, i'm trying replicate effect jquery. i've made loco searches on google 1 think of. zooming picture not problem, problem lies within scrolling, how come @ ease part.
- i'm looking solution in how make thumbnail animate when scroll page, drag behind , infront of each other in subtle way -
i've got (with lot of whirl3d in jquery-irc channel) scrollup/down part of mouse scrolling goes haywire;
i thought post here i've come many times answers lot of questions , code-errors. first post in stackoverflow , know guys geniuses! give shot! in advance!
jquery part
$(document).ready(function() { var fronts=$(".front"); var backs=$(".back"); var tempscrolltop, currentscrolltop = 0; $(document).scroll(function () { currentscrolltop = $(document).scrolltop(); if (tempscrolltop < currentscrolltop) { //scroll down fronts.animate({margintop:"-=100"},{duration:500, queue:false, easing:"easeoutback"}); backs.animate({margintop:"-=100"}, {duration:300, queue:false, easing:"easeoutback"}); console.log('scroll down'); } else if (tempscrolltop > currentscrolltop) { //scroll fronts.animate({margintop:"+=100"},{duration:500, queue:false, easing:"easeoutback"}); backs.animate({margintop:"+=100"}, {duration:300, queue:false, easing:"easeoutback"}); console.log('scroll up'); } tempscrolltop = currentscrolltop ;}) ;});
the html
<html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="http://www.paigeharvey.net/assets/js/jquery.easing.js"></script> <script type="text/javascript" src="gallery.js"></script> <title>parallax testing image gallery</title> </head> <body> <div class="container"> <div class='box front'>first group</div> <div class='box back'>first group</div> <div class='box front'>first group</div> <div class='box back'>first group</div> <br style="clear:both"/> <div class='box front'>second group</div> <div class='box back'>second group</div> <div class='box front'>second group</div> <div class='box back'>second group</div> <br style="clear:both"/> <div class='box front'>third group</div> <div class='box back'>third group</div> <div class='box front'>third group</div> <br style="clear:both"/> </div> </body>
and css part
.container {margin: auto; width: 410px; border: 1px solid red;} .box.front{border: 1px solid red;background-color:black;color:white;z-index:500;} .box.back {border: 1px solid green;z-index:300;background-color:white;} .box {float:left; text-align:center; width:100px; height:100px;}
Comments
Post a Comment