The parallax effects with jQuery

/* CSS */
.section {        width:540px; height:500px;
background:url(images/bg_freext.jpg) no-repeat #000; }
.section .inner { width:540px; height:500px;
background:url(images/fg_freext.png) no-repeat; }


/* jquery code */ // The plugin code (function($){ $.fn.parallax = function(options){ var $$ = $(this); offset = $$.offset(); var defaults = { "start": 0, "stop": offset.top + $$.height(), "coeff": 0.95 }; var opts = $.extend(defaults, options); return this.each(function(){ $(window).bind('scroll', function() { windowTop = $(window).scrollTop(); if((windowTop >= opts.start) && (windowTop <= opts.stop)) { newCoord = windowTop * opts.coeff; $$.css({ "background-position": "0 "+ newCoord + "px" }); } }); }); }; })(jQuery); // call the plugin $('.section').parallax({ "coeff":-0.65 }); $('.section .inner').parallax({ "coeff":1.15 });
http://www.franckmaurin.com/the-parallax-effects-with-jquery/ http://stephenmcintyre.net/blog/jquery-parallax-scrolling/