From 63f835949177802bb661cb233fed30f02a45945e Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 18 Mar 2019 10:23:25 +0200 Subject: [PATCH 1/2] preventDefault when dismissing store notice, this fixes jumping of page to top when clicking store notices at the bottom of the page. --- assets/js/frontend/woocommerce.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/js/frontend/woocommerce.js b/assets/js/frontend/woocommerce.js index 693ece80893..205c1be78bf 100644 --- a/assets/js/frontend/woocommerce.js +++ b/assets/js/frontend/woocommerce.js @@ -28,6 +28,7 @@ jQuery( function( $ ) { $( '.woocommerce-store-notice__dismiss-link' ).click( function() { Cookies.set( cookieName, 'hidden', { path: '/' } ); $( '.woocommerce-store-notice' ).hide(); + event.preventDefault(); }); // Make form field descriptions toggle on focus. From 2b90cf845edd529767ed377a8d369d9f98f3b47a Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 18 Mar 2019 13:09:38 +0200 Subject: [PATCH 2/2] Pass event as parameter. --- assets/js/frontend/woocommerce.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/frontend/woocommerce.js b/assets/js/frontend/woocommerce.js index 205c1be78bf..8c3cac52f4c 100644 --- a/assets/js/frontend/woocommerce.js +++ b/assets/js/frontend/woocommerce.js @@ -25,7 +25,7 @@ jQuery( function( $ ) { } // Set a cookie and hide the store notice when the dismiss button is clicked - $( '.woocommerce-store-notice__dismiss-link' ).click( function() { + $( '.woocommerce-store-notice__dismiss-link' ).click( function( event ) { Cookies.set( cookieName, 'hidden', { path: '/' } ); $( '.woocommerce-store-notice' ).hide(); event.preventDefault();