diff --git a/wp-content/themes/twentyfifteen/functions.php b/wp-content/themes/twentyfifteen/functions.php
index 4cc448ca34..5360451e71 100644
--- a/wp-content/themes/twentyfifteen/functions.php
+++ b/wp-content/themes/twentyfifteen/functions.php
@@ -226,7 +226,7 @@ function twentyfifteen_scripts() {
wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141010' );
}
- wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20141010', true );
+ wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20141212', true );
wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array(
'expand' => '' . esc_html__( 'expand child menu', 'twentyfifteen' ) . '',
'collapse' => '' . esc_html__( 'collapse child menu', 'twentyfifteen' ) . '',
diff --git a/wp-content/themes/twentyfifteen/js/functions.js b/wp-content/themes/twentyfifteen/js/functions.js
index c4ff8d7683..6610757eb0 100644
--- a/wp-content/themes/twentyfifteen/js/functions.js
+++ b/wp-content/themes/twentyfifteen/js/functions.js
@@ -66,35 +66,37 @@
function scroll() {
var windowPos = $window.scrollTop();
- if ( 955 <= windowWidth && sidebarHeight + adminbarOffset < bodyHeight ) {
- if ( sidebarHeight + adminbarOffset > windowHeight ) {
- if ( windowPos > lastWindowPos ) {
- if ( top ) {
- top = false;
- topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
- $sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
- } else if ( ! bottom && windowPos + windowHeight > sidebarHeight + $sidebar.offset().top ) {
- bottom = true;
- $sidebar.attr( 'style', 'position: fixed;bottom: 0;' );
- }
- } else if ( windowPos < lastWindowPos ) {
- if ( bottom ) {
- bottom = false;
- topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
- $sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
- } else if ( ! top && windowPos + adminbarOffset < $sidebar.offset().top ) {
- top = true;
- $sidebar.attr( 'style', 'position: fixed;' );
- }
- } else {
- top = bottom = false;
+ if ( 955 > windowWidth ) {
+ return;
+ }
+
+ if ( sidebarHeight + adminbarOffset > windowHeight ) {
+ if ( windowPos > lastWindowPos ) {
+ if ( top ) {
+ top = false;
topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
$sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
+ } else if ( ! bottom && windowPos + windowHeight > sidebarHeight + $sidebar.offset().top && sidebarHeight + adminbarOffset < bodyHeight ) {
+ bottom = true;
+ $sidebar.attr( 'style', 'position: fixed; bottom: 0;' );
}
- } else if ( ! top ) {
- top = true;
- $sidebar.attr( 'style', 'position: fixed;' );
+ } else if ( windowPos < lastWindowPos ) {
+ if ( bottom ) {
+ bottom = false;
+ topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
+ $sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
+ } else if ( ! top && windowPos + adminbarOffset < $sidebar.offset().top ) {
+ top = true;
+ $sidebar.attr( 'style', 'position: fixed;' );
+ }
+ } else {
+ top = bottom = false;
+ topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
+ $sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
}
+ } else if ( ! top ) {
+ top = true;
+ $sidebar.attr( 'style', 'position: fixed;' );
}
lastWindowPos = windowPos;