Title: Change scroll offset for error box
Last modified: June 7, 2020

---

# Change scroll offset for error box

 *  [Chris](https://wordpress.org/support/users/osiak/)
 * (@osiak)
 * [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/)
 * Hi,
    I have a fixed header and then the WooCommerce checkout page has a validation
   error and scrolls to the top where the validation box is show, part of it is 
   hidden behind my header. Here is what I tried, but didn’t work:
 *     ```
       jQuery( function( $ ) {
         $.scroll_to_notices = function( scrollElement ) {
           if ( scrollElement.length ) {
             $( 'html, body' ).animate( { scrollTop: ( scrollElement.offset().top - 200 ) }, 1000 );
           }
         };
       });
       ```
   
 * Any suggestions?
    Thx.

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

 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/#post-12951266)
 * Please post the address of your site.
 *  Thread Starter [Chris](https://wordpress.org/support/users/osiak/)
 * (@osiak)
 * [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/#post-12952563)
 * [@lorro](https://wordpress.org/support/users/lorro/) – my site is [https://webbistro.pl/konfigurator](https://webbistro.pl/konfigurator)
   
   This is a configurator plugin that at the end launches WooCommerce cart with 
   the items added there. So quite a few steps and all in Polish 🙂
 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/#post-12953389)
 * For me, the red validation error box is showing well below the header and clearly
   visible. It all looks good and works fine.
 * What browser are you using? Are you checking on a mobile device?
 *  Thread Starter [Chris](https://wordpress.org/support/users/osiak/)
 * (@osiak)
 * [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/#post-12954243)
 * Hmm, not for me… I use Chrome 83 and here is what is I see:
 * [https://iili.io/JvNL4s.jpg](https://iili.io/JvNL4s.jpg)
 * It’s missing ~50px in my case to see the top edge of the box, which now is hidden
   below the fixed header.
 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/#post-12955527)
 * I see this:
    [http://www.topcode.co.uk/wordpress/Webbistro%20checkout.png](http://www.topcode.co.uk/wordpress/Webbistro%20checkout.png)
   Looks good and works fine.
 * I’m also using Chrome 83, Mac, desktop. Have you cleared your browser cache? 
   Have you tried it when logged out?
 *  Thread Starter [Chris](https://wordpress.org/support/users/osiak/)
 * (@osiak)
 * [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/#post-12955724)
 * Funny. I love situations like this 😉
    Nevertheless, would you have a comment
   on the code to apply an offset to the scroll anyway – event if it means the error
   box will be lower than on the “correct” top place? Troubleshooting like this 
   between browser versions, systems, resolutions is something I’d like to avoid
   wasting time for – especially for such a thing. THx for understanding and help!
 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/#post-12956102)
 * Sorry, I’m not able to debug it.

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

The topic ‘Change scroll offset for error box’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [fixed header](https://wordpress.org/support/topic-tag/fixed-header/)
 * [scroll](https://wordpress.org/support/topic-tag/scroll/)
 * [scroll offset](https://wordpress.org/support/topic-tag/scroll-offset/)

 * 7 replies
 * 2 participants
 * Last reply from: [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/change-scroll-offset-for-error-box/#post-12956102)
 * Status: not resolved