Title: Bug in functions.js; please fix!
Last modified: August 22, 2016

---

# Bug in functions.js; please fix!

 *  [thewebwiz](https://wordpress.org/support/users/thewebwiz/)
 * (@thewebwiz)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/)
 * When a custom image is added to the masthead, the menu bar may well jump to the
   top of the page after scrolling just a small amount. The behavior is unpredictable–
   many browsers will correct this behavior once the image is cached, but this is
   by no means universal.
 * It’s caused by the computation of mastheadOffset taking place immediately the
   DOM is loaded – but before the image is initially loaded.
 * Changing line 63 of functions.js from this:
    `$( function() {` to this: `_window.
   load( function() {` fixes the problem.
 * P.S. I originally asked about this behavior, identifying it, wrongly, as a Safari
   bug. It can affect any browser. It was a response from the jQuery forum that 
   gave me the solution. 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [BackpackersUnion](https://wordpress.org/support/users/backpackersunion/)
 * (@backpackersunion)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/#post-5409706)
 * I can confirm this is a bug and that thewebwiz’s solution fixed it!
 * Great work and thank you!
 *  [valgosais](https://wordpress.org/support/users/valgosais/)
 * (@valgosais)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/#post-5409762)
 * For me the solution didn’t work.
    I followed these steps: – created a js folder
   in my wp-content/theme/twentyfourteen-child – pasted the functions.js into that
   folder and made the modification at the line 63
 * anyone can help?
 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/#post-5409763)
 * Did you enqueue the JavaScript from your child theme in your `functions.php`:
 *     ```
       <?php
       function twentyfourteen_child_scripts() {
         wp_enqueue_script( 'twentyfourteen-script', get_stylesheet_directory_uri() . '/js/functions.js', array( 'jquery' ), null, true );
       }
       add_action( 'wp_enqueue_scripts', 'twentyfourteen_child_scripts' );
       ```
   
 *  [valgosais](https://wordpress.org/support/users/valgosais/)
 * (@valgosais)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/#post-5409764)
 * In my child theme I have my functions.php with the new funcionts i want my wordpress
   site to apply.
 * shall i copy your code to that file?
 * If i do that:
    1) my wordpress site gives me the white screen of death
 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/#post-5409765)
 * Sorry, I wasn’t aware that you were already using a `functions.php` in your child
   theme. In that case, you don’t need to copy the first line, the `<?php`.
 *  [valgosais](https://wordpress.org/support/users/valgosais/)
 * (@valgosais)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/#post-5409767)
 * yes, of course. The tag is already open. Thankyou though for your preciceness.
 * One weird thing I englight:
    – if i do this modification from filezilla notepad,
   i’ve get back the white screen of death (the reason of my previous post) – if
   i do this modification from editor in my dashboard into my functions.php (of 
   my child theme), it does not the white screen.
 * Now i test it. Thankyou man!
 *  [valgosais](https://wordpress.org/support/users/valgosais/)
 * (@valgosais)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/#post-5409780)
 * It’s seems to really work this time! Thankyou all

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Bug in functions.js; please fix!’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/twentyfourteen/4.4/screenshot.
   png)
 * Twenty Fourteen
 * [Support Threads](https://wordpress.org/support/theme/twentyfourteen/)
 * [Active Topics](https://wordpress.org/support/theme/twentyfourteen/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/twentyfourteen/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/twentyfourteen/reviews/)

## Tags

 * [bugfix](https://wordpress.org/support/topic-tag/bugfix/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [masthead](https://wordpress.org/support/topic-tag/masthead/)
 * [overlap](https://wordpress.org/support/topic-tag/overlap/)

 * 7 replies
 * 4 participants
 * Last reply from: [valgosais](https://wordpress.org/support/users/valgosais/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/bug-in-functionsjs-please-fix/#post-5409780)
 * Status: not resolved