@@ -72,9 +72,11 @@ var $articleContainer,
7272 } , 50 ) ) ;
7373
7474 // toggle nav on interval instead of scroll to prevent queueing issues
75- setInterval ( function ( ) {
76- toggleNav ( ) ;
77- } , 200 ) ;
75+ if ( ! isMobile ( ) ) {
76+ setInterval ( function ( ) {
77+ toggleNav ( ) ;
78+ } , 200 ) ;
79+ }
7880
7981 scrollToCurrentMenuItem ( ) ;
8082} ) ( ) ;
@@ -314,6 +316,10 @@ function generateId(element) {
314316 return txt . replace ( / \s / g, "" ) . replace ( / [ ^ \w ] / g, "_" ) ;
315317}
316318
319+ function isMobile ( ) {
320+ return window . innerWidth < 1000 ;
321+ }
322+
317323function scrollToElement ( $element ) {
318324 if ( $element . length ) {
319325 var topMargin = parseInt ( $element . css ( 'margin-top' ) ) || 20 ;
@@ -387,7 +393,7 @@ function setNavToggleListener() {
387393
388394function toggleNav ( hide ) {
389395 // Don't run in mobile
390- if ( window . innerWidth < 1000 ) {
396+ if ( isMobile ( ) ) {
391397 return ;
392398 }
393399
@@ -430,6 +436,8 @@ function toggleNav(hide) {
430436 headerHidden = shouldHide ;
431437 animating = true ;
432438
439+ var $searchResultsContainer = $ ( '.search-results-container' ) ;
440+
433441 if ( shouldHide ) {
434442 $ ( '.nav-toggle' ) . show ( ) ;
435443 $everything . animate ( {
@@ -444,10 +452,21 @@ function toggleNav(hide) {
444452 animating = false ;
445453 }
446454 } ) ;
455+ $searchResultsContainer . animate ( {
456+ "height" : parseFloat ( $searchResultsContainer . css ( 'height' ) ) + headerHeight
457+ } , {
458+ duration : 250 ,
459+ complete : function ( ) {
460+ $searchResultsContainer . css ( 'height' , '' ) ;
461+ $everything . addClass ( 'header-is-hidden' ) ;
462+ }
463+ } ) ;
447464 } else {
448465 $ ( '.nav-toggle' ) . hide ( ) ;
449466 $everything . css ( 'height' , parseFloat ( $everything . css ( 'height' ) ) + headerHeight ) ;
450467 $everything . css ( 'margin-top' , 0 - headerHeight ) ;
468+ $searchResultsContainer . css ( 'height' , parseFloat ( $searchResultsContainer . css ( 'height' ) ) + headerHeight ) ;
469+ $searchResultsContainer . css ( 'margin-top' , headerHeight ) ;
451470 $nav . show ( ) ;
452471 $everything . animate ( {
453472 "margin-top" : '0' ,
@@ -456,6 +475,9 @@ function toggleNav(hide) {
456475 duration : 250 ,
457476 complete : function ( ) {
458477 animating = false ;
478+ $searchResultsContainer . css ( 'height' , '' ) ;
479+ $searchResultsContainer . css ( 'margin-top' , 0 ) ;
480+ $everything . removeClass ( 'header-is-hidden' ) ;
459481 }
460482 } ) ;
461483 }
0 commit comments