Twenty Fifteen: adjust scroll behavior to make sure sidebar height is calculated during scroll events, not just resize events.

Fixes #31734. Props jartes, lancewillett.
Built from https://develop.svn.wordpress.org/trunk@31934


git-svn-id: http://core.svn.wordpress.org/trunk@31913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2015-03-30 22:49:27 +00:00
parent 289db2d37b
commit 57918dfc8f
3 changed files with 7 additions and 6 deletions

View File

@ -250,7 +250,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-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' ), '20141212', true ); wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true );
wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array( wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array(
'expand' => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>', 'expand' => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>',
'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>', 'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>',

View File

@ -80,10 +80,7 @@
// Sidebar scrolling. // Sidebar scrolling.
function resize() { function resize() {
windowWidth = $window.width(); windowWidth = $window.width();
windowHeight = $window.height();
bodyHeight = $body.height();
sidebarHeight = $sidebar.height();
if ( 955 > windowWidth ) { if ( 955 > windowWidth ) {
top = bottom = false; top = bottom = false;
@ -98,6 +95,10 @@
return; return;
} }
sidebarHeight = $sidebar.height();
windowHeight = $window.height();
bodyHeight = $body.height();
if ( sidebarHeight + adminbarOffset > windowHeight ) { if ( sidebarHeight + adminbarOffset > windowHeight ) {
if ( windowPos > lastWindowPos ) { if ( windowPos > lastWindowPos ) {
if ( top ) { if ( top ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-beta3-31933'; $wp_version = '4.2-beta3-31934';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.