If you use $(‘body’).scrolltop () to get a value of 0, this is how Google Translate fails. Use the documentElement | | to compatible with the body.

let scrollTop = document.documentElement.scrollTop || document.body.scrollTopCopy the code

Or use

$(window).scrollTop()
Copy the code

The previous plugin using $(‘body’).scrolltop () needs to be modified