Merge pull request #20992 from woocommerce/fix/20951
Unify scroll to notices for all browsers
This commit is contained in:
commit
df0564d57e
|
@ -66,19 +66,10 @@ jQuery( function( $ ) {
|
|||
|
||||
// Common scroll to element code.
|
||||
$.scroll_to_notices = function( scrollElement ) {
|
||||
var isSmoothScrollSupported = 'scrollBehavior' in document.documentElement.style;
|
||||
|
||||
if ( scrollElement.length ) {
|
||||
if ( isSmoothScrollSupported ) {
|
||||
scrollElement[0].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
});
|
||||
} else {
|
||||
$( 'html, body' ).animate( {
|
||||
scrollTop: ( scrollElement.offset().top - 100 )
|
||||
}, 1000 );
|
||||
}
|
||||
$( 'html, body' ).animate( {
|
||||
scrollTop: ( scrollElement.offset().top - 100 )
|
||||
}, 1000 );
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue