- <script type="text/javascript">
- $(function() {
- $('.slide').each(function(){
- if ($(this).index() > 0){
- $(this).css({"position":"absolute", "top":$(this).index() * 100 + "vh"});
- }
- });
- $(window).scroll(function() {
- var window_pos = window.pageYOffset;
- $('.slide').each(function(){
- //Set the fixed position on slides when we scroll past them.
- if ($(this).index() > 0){
- $(this).css({"position":"absolute", "top":$(this).index() * 100 + "vh"});
- if(window_pos > $(this).offset().top) {
- $(this).css({"position":"fixed", "top":"0"});
- }
- }
- });
- });
- });
- </script>
<script type="text/javascript">
$(function() {
$('.slide').each(function(){
if ($(this).index() > 0){
$(this).css({"position":"absolute", "top":$(this).index() * 100 + "vh"});
}
});
$(window).scroll(function() {
var window_pos = window.pageYOffset;
$('.slide').each(function(){
//Set the fixed position on slides when we scroll past them.
if ($(this).index() > 0){
$(this).css({"position":"absolute", "top":$(this).index() * 100 + "vh"});
if(window_pos > $(this).offset().top) {
$(this).css({"position":"fixed", "top":"0"});
}
}
});
});
});
</script>
- <div id="one" class="slide">
- <div class="content ">
- <span class="bigText">These slides will stack <b>on top of each other.</b></span>
- </div>
- </div>
- <div id="two" class="slide gray">
- <div class="content ">
- <span class="bigText">Creating a really <b>nice effect</b></span>
- </div>
- </div>
- <div id="three" class="slide gray">
- <div class="content ">
- <span class="bigText">You can have as many <b>slides</b></span>
- <span class="bigText">as you want</span>
- </div>
- </div>
<div id="one" class="slide"> <div class="content"> <span class="bigText">These slides will stack <b>on top of each other.</b></span> </div> </div> <div id="two" class="slide gray"> <div class="content"> <span class="bigText">Creating a really <b>nice effect</b></span> </div> </div> <div id="three" class="slide gray"> <div class="content"> <span class="bigText">You can have as many <b>slides</b></span> <span class="bigText">as you want</span> </div> </div>