Title: Offset for Navigation
Last modified: August 21, 2016

---

# Offset for Navigation

 *  Resolved [jkash23686](https://wordpress.org/support/users/jkash23686/)
 * (@jkash23686)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/offset-for-navigation/)
 * Is there any easy way to set up an off set to adjust for the height of a navigation?
 * [https://wordpress.org/plugins/wp-localscroll/](https://wordpress.org/plugins/wp-localscroll/)

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

 *  Plugin Author [philiprabbett](https://wordpress.org/support/users/philiprabbett/)
 * (@philiprabbett)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/offset-for-navigation/#post-4617914)
 * I’m currently working on enabling options for this but in the meantime, if you
   open the file **_wp-localscroll.php_** and change the following:
 *     ```
       // When the document is loaded...
           jQuery(document).ready(function($) {
             // Scroll initially if there's a hash (#something) in the url
             $.localScroll.hash( {
               target: 'body', // Could be a selector or a jQuery object too.
               duration:1500
             });
   
             /**
              * Scroll the whole document
              * NOTE: I use $.localScroll instead of $('#navigation').localScroll().
             */
             $.localScroll({
               target: 'body', // Could be a selector or a jQuery object too.
               duration:1000,
               hash:true
             });
           });
       ```
   
 * to
 *     ```
       // When the document is loaded...
           jQuery(document).ready(function($) {
             // Scroll initially if there's a hash (#something) in the url
             $.localScroll.hash( {
               target: 'body', // Could be a selector or a jQuery object too.
               duration:1500,
               offset: { top: -200 } //offset by the height of your header (give or take a few px, see what works for you)
             });
   
             /**
              * Scroll the whole document
              * NOTE: I use $.localScroll instead of $('#navigation').localScroll().
             */
             $.localScroll({
               target: 'body', // Could be a selector or a jQuery object too.
               duration:1000,
               offset: { top: -200 }, //offset by the height of your header (give or take a few px, see what works for you)
               hash:true
             });
           });
       ```
   
 * See if that works
 *  [realramble](https://wordpress.org/support/users/realramble/)
 * (@realramble)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/offset-for-navigation/#post-4617919)
 * The above solution works perfectly. Another way to address this is with CSS, 
   which would work with or without the scroll plugin. Create a class:
 *     ```
       /* Allow jump anchor text to appear somewhat below the top screen edge */
       .anchor { position: relative;
           padding-top: 45px;
       }
       ```
   
 * Change the pixel height to suit your needs. Then change the HTML anchor code 
   as follows:
 * `<a class="anchor" name="example-text"></a>`
 * See examples of this at [http://realramble.com/tips-for-home-buyers](http://realramble.com/tips-for-home-buyers)
 *  [dan77](https://wordpress.org/support/users/dan77/)
 * (@dan77)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/offset-for-navigation/#post-4617925)
 * thanks philiprabbett for the good work! the offset works great, even coming from
   other pages it works!
 * it would be great if you can add the functionality in the core of the plugin.
   having a one-page scroll website usually comes with a fixed header, so I guess
   many people will enjoy this offset-feature.
 * cheers!

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

The topic ‘Offset for Navigation’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-localscroll.svg)
 * [WP LocalScroll](https://wordpress.org/plugins/wp-localscroll/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-localscroll/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-localscroll/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-localscroll/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-localscroll/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-localscroll/reviews/)

 * 3 replies
 * 4 participants
 * Last reply from: [dan77](https://wordpress.org/support/users/dan77/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/offset-for-navigation/#post-4617925)
 * Status: resolved