• 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)
  • I can confirm this is a bug and that thewebwiz’s solution fixed it!

    Great work and thank you!

    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?

    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' );

    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

    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.

    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!

    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.