Team:Cornell/sandbox
From 2013.igem.org
(Difference between revisions)
Line 9: | Line 9: | ||
<!-- Remove all empty <p> tags --> | <!-- Remove all empty <p> tags --> | ||
- | <script | + | <script type="text/javascript"> |
$(document).ready(function() { | $(document).ready(function() { | ||
$("p").filter( function() { | $("p").filter( function() { | ||
Line 315: | Line 315: | ||
----------------------------------------- */ | ----------------------------------------- */ | ||
.section { | .section { | ||
- | + | position: absolute; | |
- | + | ||
} | } | ||
.section .inner { | .section .inner { | ||
- | + | z-index: 2; | |
- | + | position: fixed; | |
- | + | ||
} | } | ||
Line 329: | Line 327: | ||
</style> | </style> | ||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> | ||
- | + | $(window).bind('scroll',function(e){ | |
+ | parallaxScroll(); | ||
+ | }); | ||
+ | |||
+ | function parallaxScroll(){ | ||
+ | var scrolled = $(window).scrollTop(); | ||
+ | $('.section').css('top',(0-(scrolled*.25))+'px'); | ||
+ | $('.inner').css('top',(0-(scrolled*.5))+'px'); | ||
+ | } | ||
</script> | </script> | ||
</head> | </head> | ||
Line 338: | Line 344: | ||
<div class="section"> | <div class="section"> | ||
<div class="inner"> | <div class="inner"> | ||
- | + | Texty text | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
</div> | </div> |
Revision as of 17:04, 26 December 2013
Whee
Texty text