How to get the location where the web page was scrolled by JavaScript
This article mainly introduces JavaScript how to get the location where the web page was scrolled, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.
Get the location where the page was scrolled away function getScrollXY () {
Return document.body.scrollTop
? {
X: document.body.scrollLeft
Y: document.body.scrollTop
}
: {
X: document.documentElement.scrollLeft
Y: document.documentElement.scrollTop
}
} the characteristic of JavaScript 1.JavaScript is mainly used to add interactive behavior to HTML pages. 2.JavaScript can be embedded directly into HTML pages, but writing as a separate js file facilitates the separation of structure and behavior. 3.JavaScript has cross-platform features and can run on multiple platforms with the support of most browsers.
Thank you for reading this article carefully. I hope the article "how to get the location where the web page has been scrolled" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!