jquery - How to obtain non-uniformly scrolling elements and layered "curtain-like" backgrounds on a webpage? -
i'm talking websites this fulltoss one , this asus one.
i'm fascinated how each of floated elements seems scrolling @ different pace. , how backgrounds appear layered , rise curtains, hiding visible elements, , revealing new ones, user scrolls down or page.
i'm not able head around writing css/jquery achieve effect. help, or tiny working example help!
edit :
andrew , sevenseacat pointing me "parallax" effect. know several websites use it, including this insane 1 loops around scrolling, , this range rover site doesn't have scrollbar!
i've accepted scott's answer since directly answers question, andrew directing me more resources.
looking through source code first link, appears using 1 main jquery plugin handle scroll event - parallax. http://stephband.info/jparallax/. allows developer set scroll speed different parts of page relative normal scroll event. following code excerpt first link should provide context happening.
$(document).ready(function(){ //.parallax(xposition, speedfactor, outerheight) options: //xposition - horizontal position of element //inertia - speed move relative vertical scroll. example: 0.1 1 tenth speed of scrolling, 2 twice speed of scrolling //outerheight (true/false) - whether or not jquery should use it's outerheight option determine when section in viewport $('#first').parallax("25%", 0.1); $('.ft1-small-1-bg').parallax("75%", 0.4); $('.ft1-small-2-bg').parallax("75%", 0.2); $('#second').parallax("25%", 0.1); $('.ft2-small-1-bg').parallax("100%", 0.4); $('.ft2-small-2-bg').parallax("100%", 0.2); $('#third').parallax("50%", 0.3); $('.ft3-small-1-bg').parallax("100%", 0.4); $('.ft3-small-2-bg').parallax("100%", 0.2); $('#fourth').parallax("50%", 0.3); $('.ft4-small-1-bg').parallax("10%", 0.4); $('.ft4-small-2-bg').parallax("10%", 0.2); $('.ft4-small-3-bg').parallax("110%", 0.2); $('.ft4-small-4-bg').parallax("110%", 0.2); $('.tabs-menu a').fttabs(); var viewportheight = screen.height; var headerheight = $('.fulltoss-header').outerheight(); var vheight = viewportheight-headerheight; $('#fourth.page').height(vheight); $('#fourth .story').css('height',vheight); $('#fourth .story').css('min-height',vheight); $('#fourth .story').css('overflow','hidden'); $('.ft4-small-1-bg, .ft4-small-2-bg, .ft4-small-3-bg, .ft4-small-4- bg').height(vheight); });
source - http://www.espncricinfo.com/navigation/zones/fulltoss/main.js?10
Comments
Post a Comment