Switch branches/tags
Nothing to show
Find file
86ca1df Jul 13, 2012
@IanLunn @fidian
executable file 91 lines (79 sloc) 5.04 KB
<!DOCTYPE html>
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Parallax Plugin Demo</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src=""></script>
<script type="text/javascript" src="scripts/jquery.parallax-1.1.3.js"></script>
<script type="text/javascript" src="scripts/jquery.localscroll-1.2.7-min.js"></script>
<script type="text/javascript" src="scripts/jquery.scrollTo-1.4.2-min.js"></script>
<script type="text/javascript">
//.parallax(xPosition, speedFactor, outerHeight) options:
//xPosition - Horizontal position of the element
//inertia - speed to move relative to vertical scroll. Example: 0.1 is one tenth the speed of scrolling, 2 is twice the speed of scrolling
//outerHeight (true/false) - Whether or not jQuery should use it's outerHeight option to determine when a section is in the viewport
$('#intro').parallax("50%", 0.1);
$('#second').parallax("50%", 0.1);
$('.bg').parallax("50%", 0.4);
$('#third').parallax("50%", 0.3);
<ul id="nav">
<li><a href="#intro" title="Next Section"><img src="images/dot.png" alt="Link" /></a></li>
<li><a href="#second" title="Next Section"><img src="images/dot.png" alt="Link" /></a></li>
<li><a href="#third" title="Next Section"><img src="images/dot.png" alt="Link" /></a></li>
<li><a href="#fifth" title="Next Section"><img src="images/dot.png" alt="Link" /></a></li>
<div id="intro">
<div class="story">
<div class="float-left">
<h2>(Almost) Static Background</h2>
<p>This section has a background that moves slightly slower than the user scrolls. This is achieved by changing the top position of the background for every pixel the page is scrolled.</p>
</div> <!--.story-->
</div> <!--#intro-->
<div id="second">
<div class="story"><div class="bg"></div>
<div class="float-right">
<h2>Multiple Backgrounds</h2>
<p>The multiple backgrounds applied to this section are moved in a similar way to the first section -- every time the user scrolls down the page by a pixel, the positions of the backgrounds are changed.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nibh erat, sagittis sit amet congue at, aliquam eu libero. Integer molestie, turpis vel ultrices facilisis, nisi mauris sollicitudin mauris, volutpat elementum enim urna eget odio. Donec egestas aliquet facilisis. Nunc eu nunc eget neque ornare fringilla. Nam vel sodales lectus. Nulla in pellentesque eros. Donec ultricies, enim vitae varius cursus, risus mauris iaculis neque, euismod sollicitudin metus erat vitae sapien. Sed pulvinar.</p>
</div> <!--.story-->
</div> <!--#second-->
<div id="third">
<div class="story">
<div class="float-left">
<h2>What Happens When JavaScript is Disabled?</h2>
<p>The user gets a slap! Actually, all that jQuery does is moves the backgrounds relative to the position of the scrollbar. Without it, the backgrounds simply stay put and the user would never know they are missing out on the awesome! CSS2 does a good enough job to still make the effect look cool.</p>
</div> <!--.story-->
</div> <!--#third-->
<div id="fifth">
<div class="story">
<p>Check out my new plugin <a href="" title="Sequence.js">Sequence.js</a> for parallax effects and a whole lot more!</p>
<h2>Ian Lunn</h2>
<li><strong>Twitter</strong>: <a href="" title="Follow Ian on Twitter">@IanLunn</a></li>
<li><strong>GitHub</strong>: <a href="" title="Follow Ian on GitHub">IanLunn</a></li>
<li><strong>Website</strong>: <a href="" title="Ian Lunn Design"></a></li>
<p>This demo is based on the <a href="" title="Nike Better World"></a> website.</p>
<p>This plugin makes use of some scripts and images made by others:</p>
<li><a href="" title="jQuery ScrollTo">jQuery ScrollTo</a></li>
<li><a href="" title="Background Textures">Wooden and Pyschedlic Background Textures</a></li>
<li><a href="" title="Trainers Image">Trainers Image</a></li>
<li><a href="" title="Basketball Image">Basketball Image</a></li>
<li><a href="" title="Bottles Image">Bottles Image</a></li>
</div> <!--.story-->
</div> <!--#fifth-->