diff --git a/js/stickynav.js b/js/stickynav.js index 553950d..7975ed5 100644 --- a/js/stickynav.js +++ b/js/stickynav.js @@ -11,7 +11,7 @@ jQuery(document).ready(function( $ ) { if($('#wpadminbar').length > 0) adminHeight = $('#wpadminbar').outerHeight(); elem.attr('data-top', Math.round(parseFloat(offset.top - adminHeight))); } - if ($(window).width() >= 768 && Math.round(parseFloat(elem.attr('data-top'))) - elem.outerHeight() <= $(this).scrollTop() - $(elem).outerHeight()){ + if (window.innerWidth >= 768 && Math.round(parseFloat(elem.attr('data-top'))) - elem.outerHeight() <= $(this).scrollTop() - $(elem).outerHeight()){ elem.addClass('navbar-fixed-top'); elem.css('padding-top',$('#wpadminbar').outerHeight()); } @@ -27,7 +27,7 @@ jQuery(document).ready(function( $ ) { $('#masthead').children().each(function(){mastheadHeight += $(this).height();}); $('#masthead').css('height',mastheadHeight+'px'); var elem = $('#nav-wrapper'); - if ($(window).width() >= 768 && !elem.hasClass('navbar-fixed-top')){ + if (window.innerWidth >= 768 && !elem.hasClass('navbar-fixed-top')){ var offset = elem.offset(); var adminHeight = 0; if($('#wpadminbar').length > 0) adminHeight = $('#wpadminbar').outerHeight();