Merge pull request #20992 from woocommerce/fix/20951

Unify scroll to notices for all browsers
This commit is contained in:
Claudiu Lodromanean 2018-08-06 12:19:12 -07:00 committed by GitHub
commit df0564d57e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 12 deletions

View File

@ -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 );
}
};
});