- <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(){
-
-
- 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>