Difference between revisions of "Template:Exeter"

Line 391: Line 391:
 
     -webkit-margin-after: 0;
 
     -webkit-margin-after: 0;
 
     -webkit-padding-start: 0;}
 
     -webkit-padding-start: 0;}
 +
 +
 +
/*ScrollUp*/
 +
#bodycontent {
 +
    padding-top: 100px;
 +
}
 +
 +
.navbar-fixed-top {
 +
    height: 100px;
 +
    position: fixed;
 +
    top: 0;
 +
    transition: top 0.2s ease-in-out;
 +
    width: 100%;
 +
}
 +
 +
.nav-up {
 +
top:-100px;
 +
}
 +
 +
#wrapper {
 +
height:2000px;
 +
}
  
 
</style>
 
</style>
 +
 +
<script type="text/javascript">
 +
// Hide Header on on scroll down
 +
var didScroll;
 +
var lastScrollTop = 0;
 +
var delta = 5;
 +
var navbarHeight = $('nav').outerHeight();
 +
 +
$(window).scroll(function(event){
 +
    didScroll = true;
 +
});
 +
 +
setInterval(function() {
 +
    if (didScroll) {
 +
        hasScrolled();
 +
        didScroll = false;
 +
    }
 +
}, 250);
 +
 +
function hasScrolled() {
 +
    var st = $(this).scrollTop();
 +
   
 +
    // Make sure they scroll more than delta
 +
    if(Math.abs(lastScrollTop - st) <= delta)
 +
        return;
 +
   
 +
    // If they scrolled down and are past the navbar, add class .nav-up.
 +
    // This is necessary so you never see what is "behind" the navbar.
 +
    if (st > lastScrollTop && st > navbarHeight){
 +
        // Scroll Down
 +
        $('.navbar-collapse').addClass('nav-up');
 +
    } else {
 +
        // Scroll Up
 +
        if(st + $(window).height() < $(document).height()) {
 +
            $('.navbar-collapse').removeClass('nav-up');
 +
        }
 +
    }
 +
   
 +
    lastScrollTop = st;
 +
}
 +
</script>
 +
 +
<script>
 +
$(document).ready(function() {
 +
 
 +
  $(window).scroll(function () {
 +
      //if you hard code, then use console
 +
      //.log to determine when you want the
 +
      //nav bar to stick. 
 +
      console.log($(window).scrollTop())
 +
    if ($(window).scrollTop() > 182) {
 +
      $('.navbar-collapse').addClass('navbar-fixed-top');
 +
    }
 +
    if ($(window).scrollTop() < 183) {
 +
      $('.navbar-collapse').removeClass('navbar-fixed-top');
 +
    }
 +
  });
 +
});
 +
</script>
  
 
<div id="wrapper">
 
<div id="wrapper">
Line 564: Line 645:
 
$(document).ready(main);
 
$(document).ready(main);
  
</script>
 
 
<script>
 
$(document).ready(function() {
 
 
 
  $(window).scroll(function () {
 
      //if you hard code, then use console
 
      //.log to determine when you want the
 
      //nav bar to stick. 
 
      console.log($(window).scrollTop())
 
    if ($(window).scrollTop() > 182) {
 
      $('.navbar-collapse').addClass('navbar-fixed-top');
 
    }
 
    if ($(window).scrollTop() < 183) {
 
      $('.navbar-collapse').removeClass('navbar-fixed-top');
 
    }
 
  });
 
});
 
 
</script>
 
</script>
  

Revision as of 17:33, 27 August 2015