Title: fixed menu issue
Last modified: October 6, 2017

---

# fixed menu issue

 *  Resolved [szalmo](https://wordpress.org/support/users/szalmo/)
 * (@szalmo)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/)
 * hi, i have an issue with the fixed menu: i move it below the viewport of the 
   main page (as now it is) but when you scroll down you have a little jump (of 
   the same amount of pixels of the menu height) when it switches to “position: 
   fixed”.
    i have find the .js where this happens but i’m not able to edit it in
   the right way. help, please.
 * thank you so much
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffixed-menu-issue%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/fixed-menu-issue/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/fixed-menu-issue/page/2/?output_format=md)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9561695)
 * That’s because the JS applying the fixed header is applied in a way that assumes
   the navigation is on top of that image. As the navigation is no longer on top
   you will have to change the logic of the JS.
 * The change is simple. This bit:
 *     ```
       if ( isFrontPage && ( $body.hasClass( 'has-header-image' ) || $body.hasClass( 'has-header-video' ) ) ) {
       	headerOffset = $customHeader.innerHeight() - navigationOuterHeight;
       } else {
       	headerOffset = $customHeader.innerHeight();
       }
       ```
   
 * Just needs to be replaced with this:
 *     ```
       headerOffset = $customHeader.innerHeight();
       ```
   
 * However you shouldn’t do that directly in the theme’s JS because that would be
   bad practice and you will lose those changes when the theme updates.
 * This question is related to the fix; how did you move the menu below the viewport?
   Where did you make that change, what files etc.?
    -  This reply was modified 8 years, 8 months ago by [Andrew Nevins](https://wordpress.org/support/users/anevins/).
 *  Thread Starter [szalmo](https://wordpress.org/support/users/szalmo/)
 * (@szalmo)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9561865)
 * hi thank you for the answer.
    i have a child theme and i make the changes in 
   the wordpress customizator. anyway i don’t have duplicate the global.js (where
   the string you suggest is, isn’t it?) and, just to try, i edit the one in the
   mail theme directory and i get no effects on the site. it looks like global.js
   doesn’t affect the site in any way, but i edit it from the editor in mycPanel
   control panel and this could be a problem…. any suggestion about it?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562111)
 * Global.js is certainly loading on your site, but rather than try to hack it in
   let’s do it the proper way. Then if it still doesn’t work we can debug it easier,
   because we know it _should_ work.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562138)
 * We need to dequeue the theme’s global.js file first. The theme added this file
   using this line in the functions.php file:
 *     ```
       wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '1.0', true );
       ```
   
 * To dequeue it, in your Child Theme’s functions.php file add this:
 *     ```
       wp_dequeue_script('twentyseventeen-global')
       ```
   
 * _[https://developer.wordpress.org/reference/functions/wp\_dequeue\_script/](https://developer.wordpress.org/reference/functions/wp_dequeue_script/)_
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562464)
 * Then create a new ‘global.js’ file inside your Child Theme folder. Edit it and
   copy all of the code from this PasteBin page and put it inside that global.js
   file & save: [https://pastebin.com/9Gx6Z8dW](https://pastebin.com/9Gx6Z8dW)
 * You can then load this Child Theme ‘global.js’ file inside your functions.php
   file by enqueing it like so:
 *     ```
       wp_enqueue_script( 'child-twentyseventeen-global', get_stylesheet_directory_uri()  . '/global.js' ), array( 'jquery' ), '1.0', true );
       ```
   
    -  This reply was modified 8 years, 8 months ago by [Andrew Nevins](https://wordpress.org/support/users/anevins/).
    -  This reply was modified 8 years, 8 months ago by [Andrew Nevins](https://wordpress.org/support/users/anevins/).
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562496)
 * Sorry I’ve now linked the Pastebin page in the latest post ^.
 *  Thread Starter [szalmo](https://wordpress.org/support/users/szalmo/)
 * (@szalmo)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562521)
 * i copied the global.js in the child theme dir and it works!
    this said i don’t
   understand why i need to dequeue the global.js in the main theme… could you explain?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562547)
 * JS cannot be overridden like CSS. To make a JS modification you need to remove
   the original JS and replace it with the updated JS.
 *  Thread Starter [szalmo](https://wordpress.org/support/users/szalmo/)
 * (@szalmo)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562559)
 * it’s strange because i have made the changes in the child theme (without dequeue
   the main) and it works…
    moreover: now the navigation act correctly (thanks dude)
   but i still have an issue with positioning. the div of the contents jump of the
   same amount of pixel previously occupated by the navigation (when the navigation
   changes her position from relative to absolute)
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562566)
 * > it’s strange because i have made the changes in the child theme (without dequeue
   > the main) and it works…
 * Can you replicate that again? I’d like to investigate.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562569)
 * > . the div of the contents jump of the same amount of pixel previously occupated
   > by the navigation (when the navigation changes her position from relative to
   > absolute)
 * I’m not sure I understand. If I control the scrollbar my hand and slowly scroll
   down in small steps the navigation snaps to the point where it should snap.
 *  Thread Starter [szalmo](https://wordpress.org/support/users/szalmo/)
 * (@szalmo)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562585)
 * here is the source of my site: [https://www.dropbox.com/s/0zvyoxxbak7cs1g/Screen%20Shot%202017-10-06%20at%2014.24.12.png?dl=0](https://www.dropbox.com/s/0zvyoxxbak7cs1g/Screen%20Shot%202017-10-06%20at%2014.24.12.png?dl=0)
 * excuse my english… it’s normal you don’t understand ahah.
    the problem is not
   with navigation (acts correctly) but the div containing the contents… scrolling
   slowly you can see it takes a jump when the navbar changes from floating to fixed…
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562590)
 * > here is the source of my site: [https://www.dropbox.com/s/0zvyoxxbak7cs1g/Screen%20Shot%202017-10-06%20at%2014.24.12.png?dl=0](https://www.dropbox.com/s/0zvyoxxbak7cs1g/Screen%20Shot%202017-10-06%20at%2014.24.12.png?dl=0)
 * Are you saying you’ve currently not made changes to your Child Theme functions.
   php to enqueue/ dequeue the scripts?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562591)
 * > it takes a jump when the navbar changes from floating to fixed…
 * To me this is expected behaviour, but can you tell me what you’re expecting to
   happen at this point?
 *  Thread Starter [szalmo](https://wordpress.org/support/users/szalmo/)
 * (@szalmo)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/#post-9562641)
 * > Are you saying you’ve currently not made changes to your Child Theme functions.
   > php to enqueue/ dequeue the scripts?
 * yes i don’t edit functions.php – if the file exist in the child theme then the
   site loads this one…
 * > To me this is expected behaviour, but can you tell me what you’re expecting
   > to happen at this point?
 * mmmm… no i think the content div has to smoothly scroll indipendently from the
   navigation bar… i don’t know how to explain…
 * (thanks for your patience)

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/fixed-menu-issue/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/fixed-menu-issue/page/2/?output_format=md)

The topic ‘fixed menu issue’ is closed to new replies.

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

 * 19 replies
 * 2 participants
 * Last reply from: [szalmo](https://wordpress.org/support/users/szalmo/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/fixed-menu-issue/page/2/#post-9562754)
 * Status: resolved