Hey there, currently I am utilizing a combination of jquery and css to affix my navigation menu at the top when scrolled. However, the problem is that my navigation menu is positioned beneath a div with a height set in viewport units (vh). The jquery script does not seem to recognize vh as a valid measurement for height. Any ideas on how I can modify it to accept vh?
$(function(){
$(window).scroll(function() {
if ($(this).scrollTop() >= 290) {
$('nav.stickynav').addClass('stickytop');
}
else {
$('nav.stickynav').removeClass('stickytop');
}
});
});
.stickynav.stickytop {
position:fixed;
top:0
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<header class="group">
<img src="<?php echo get_bloginfo('template_directory');?>/img/es.png">
<nav class="stickynav"><?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?></nav>
</header>