Difference between revisions of "Template:British Columbia 2"

m
m
Line 77: Line 77:
 
   background-color: grey;
 
   background-color: grey;
 
}
 
}
 +
  
 
</style>
 
</style>
 
<script>
 
<script>
// get the value of the bottom of the #main element by adding the offset of that element plus its height, set it as a variable
+
window.onscroll = function(){scrollFunction()};
var mainbottom = $(".cover").offset().top + $(".cover").height();
+
  
// on scroll,
+
function scrollFunction(){
$(window).on("scroll",function(){
+
     if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
 
+
         document.getElementById("navigation-bar").className = "opaque-nav";
     // we round here to reduce a little workload
+
    stop = Math.round($(window).scrollTop());
+
    if (stop > mainbottom) {
+
         $('.navbar-default').addClass('.opaque-nav');
+
 
     } else {
 
     } else {
         $('.navbar-default').removeClass('.opaque-nav');
+
         document.getElementById("navigation-bar").className = "";
 
     }
 
     }
 +
}
 +
  
});
 
 
</script>
 
</script>
 
</head>
 
</head>
 
<header>
 
<header>
   <nav class="navbar navbar-default navbar-fixed-top">
+
   <nav class="navbar navbar-default navbar-fixed-top" id="navigation-bar">
 
     <div class="container-fluid">
 
     <div class="container-fluid">
 
       <div class="navbar-header">
 
       <div class="navbar-header">

Revision as of 13:57, 3 October 2016

Home

Eagles