From 7392fd66af4014a21ce59f601fa02ac28bedf0b9 Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Tue, 3 Dec 2013 18:34:34 +0000 Subject: [PATCH] Twenty Fourteen: reposition the window on jump-to-anchor to account for header height. Props obenland, fixes #26213. git-svn-id: https://develop.svn.wordpress.org/trunk@26574 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentyfourteen/functions.php | 2 +- src/wp-content/themes/twentyfourteen/js/functions.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wp-content/themes/twentyfourteen/functions.php b/src/wp-content/themes/twentyfourteen/functions.php index 55db783a32..529d739e81 100644 --- a/src/wp-content/themes/twentyfourteen/functions.php +++ b/src/wp-content/themes/twentyfourteen/functions.php @@ -263,7 +263,7 @@ function twentyfourteen_scripts() { ) ); } - wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131102', true ); + wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131203', true ); } add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); diff --git a/src/wp-content/themes/twentyfourteen/js/functions.js b/src/wp-content/themes/twentyfourteen/js/functions.js index 24802e516c..8299945ef4 100644 --- a/src/wp-content/themes/twentyfourteen/js/functions.js +++ b/src/wp-content/themes/twentyfourteen/js/functions.js @@ -48,6 +48,9 @@ } element.focus(); + + // Repositions the window on jump-to-anchor to account for header height. + window.scrollBy( 0, -80 ); } } );