m |
m |
||
Line 74: | Line 74: | ||
</style> | </style> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</head> | </head> | ||
<header> | <header> | ||
Line 143: | Line 126: | ||
</nav> | </nav> | ||
</header> | </header> | ||
+ | <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 | ||
+ | var mainbottom = $(".cover").offset().top + $(".cover").height(); | ||
+ | // on scroll, | ||
+ | $(window).on("scroll",function(){ | ||
+ | |||
+ | // we round here to reduce a little workload | ||
+ | stop = Math.round($(window).scrollTop()); | ||
+ | if (stop > mainbottom) { | ||
+ | $('.navbar-default').addClass('.opaque-nav'); | ||
+ | } else { | ||
+ | $('.navbar-default').removeClass('.opaque-nav'); | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | </script> | ||
<body></body> | <body></body> | ||
</html> | </html> |
Revision as of 13:26, 3 October 2016