diff --git a/files/en-us/_redirects.txt b/files/en-us/_redirects.txt index 520dd99f48c6ecc..49005c0c7a81e76 100644 --- a/files/en-us/_redirects.txt +++ b/files/en-us/_redirects.txt @@ -10195,6 +10195,8 @@ /en-US/docs/Web/API/Window/onvrdisplaypointerunrestricted /en-US/docs/Web/API/Window /en-US/docs/Web/API/Window/onvrdisplaypresentchange /en-US/docs/Web/API/Window/vrdisplaypresentchange_event /en-US/docs/Web/API/Window/openDialog /en-US/docs/Web/API/Window +/en-US/docs/Web/API/Window/pageXOffset /en-US/docs/Web/API/Window/scrollX +/en-US/docs/Web/API/Window/pageYOffset /en-US/docs/Web/API/Window/scrollY /en-US/docs/Web/API/Window/performance /en-US/docs/Web/API/performance_property /en-US/docs/Web/API/Window/removeEventListener /en-US/docs/Web/API/EventTarget/removeEventListener /en-US/docs/Web/API/Window/resolveLocalFileSystemURL /en-US/docs/Web/API/File_and_Directory_Entries_API#resolvelocalfilesystemurl() diff --git a/files/en-us/_wikihistory.json b/files/en-us/_wikihistory.json index a3a82b25063cc78..f854ad6ade6790b 100644 --- a/files/en-us/_wikihistory.json +++ b/files/en-us/_wikihistory.json @@ -68020,30 +68020,6 @@ "JesseW" ] }, - "Web/API/Window/pageXOffset": { - "modified": "2020-10-15T21:37:54.373Z", - "contributors": [ - "mfluehr", - "fscholz", - "erikadoyle", - "mrenty", - "cvrebert", - "Sheppy" - ] - }, - "Web/API/Window/pageYOffset": { - "modified": "2020-10-15T21:37:58.277Z", - "contributors": [ - "alattalatta", - "fscholz", - "jamesdhurd", - "hannahcancode", - "Sheppy", - "erikadoyle", - "mrenty", - "cvrebert" - ] - }, "Web/API/Window/pagehide_event": { "modified": "2020-10-15T21:19:33.376Z", "contributors": [ diff --git a/files/en-us/web/api/window/pagexoffset/index.md b/files/en-us/web/api/window/pagexoffset/index.md deleted file mode 100644 index 9f9806b12137157..000000000000000 --- a/files/en-us/web/api/window/pagexoffset/index.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: "Window: pageXOffset property" -short-title: pageXOffset -slug: Web/API/Window/pageXOffset -page-type: web-api-instance-property -browser-compat: api.Window.pageXOffset ---- - -{{ APIRef("CSSOM View") }} - -The read-only {{domxref("Window")}} property **`pageXOffset`** is an alias for [`scrollX`](/en-US/docs/Web/API/Window/scrollX). - -## Specifications - -{{Specifications}} - -## Browser compatibility - -{{Compat}} - -## See also - -- {{domxref("Window.pageYOffset", "pageYOffset")}} diff --git a/files/en-us/web/api/window/pageyoffset/index.md b/files/en-us/web/api/window/pageyoffset/index.md deleted file mode 100644 index 8d992c9670b7660..000000000000000 --- a/files/en-us/web/api/window/pageyoffset/index.md +++ /dev/null @@ -1,172 +0,0 @@ ---- -title: "Window: pageYOffset property" -short-title: pageYOffset -slug: Web/API/Window/pageYOffset -page-type: web-api-instance-property -browser-compat: api.Window.pageYOffset ---- - -{{ APIRef("CSSOM View") }} - -The read-only {{domxref("Window")}} property **`pageYOffset`** -is an alias for {{domxref("Window.scrollY", "scrollY")}}; as such, it returns the number -of pixels the document is currently scrolled along the vertical axis (that is, up or -down) with a value of 0.0, indicating that the top edge of the {{domxref("Document")}} -is currently aligned with the top edge of the window's content area. - -There is slightly better support for `pageYOffset` than for -`scrollY` in older browsers, but if you're not concerned about browsers more -than a handful of years old, you can use either one. - -The corresponding {{domxref("Window.pageXOffset", "pageXOffset")}} property, which -returns the number of pixels scrolled along the horizontal axis (left and right), is an -alias for {{domxref("Window.scrollX", "scrollX")}}. - -## Value - -A double-precision floating-point number specifying the number of pixels the {{domxref("Document")}} -is scrolled vertically within its containing {{domxref("Window")}}. This number is subpixel precise -with a range of E(min)=-1022 to E(max)=1023, so it may not be an integer. A value of 0.0 indicates -that the window is not scrolled vertically, and that the top of the document is located at the top -edge of the window's content area. - -Since this property is an alias for {{domxref("Window.scrollY")}}, see that article for -additional details on this value and its use. - -## Examples - -```js hidden -const contentHTML = ` -
Lorem ipsum dolor sit amet, consectetur adipiscing -elit. Aenean volutpat vitae felis non dictum. Ut auctor -eros tortor, vel elementum arcu rhoncus nec. Donec non -laoreet massa. Donec pretium nisi et condimentum convallis. -Nullam dictum molestie finibus. Nullam vitae lorem non -augue mattis cursus.
-Maecenas nec tortor tincidunt, sollicitudin mi eget, -fermentum turpis. Vestibulum ac ante et libero efficitur -faucibus id eget ex. Pellentesque tempor pharetra -tincidunt. Suspendisse potenti. Nulla vulputate nunc sit -amet hendrerit faucibus. Nullam metus dui, venenatis -lacinia nunc nec, vestibulum viverra nunc. Quisque interdum -quam tortor, sit amet varius neque consectetur at. Quisque -vel turpis justo.
-Lorem ipsum dolor sit amet, consectetur adipiscing -elit. Etiam dui dolor, pulvinar sed diam id, eleifend -dapibus odio. Duis vitae ante nibh. Integer bibendum -imperdiet suscipit. Fusce ligula leo, consectetur ac ante -eget, gravida laoreet purus. Cras sodales efficitur risus, -sed feugiat sem. Pellentesque justo augue, placerat non leo -sit amet, laoreet fringilla arcu.
-Class aptent taciti sociosqu ad litora torquent per -conubia nostra, per inceptos himenaeos. Proin in gravida -libero. Vivamus placerat, lacus eget condimentum sagittis, -enim nunc bibendum nisi, quis varius erat felis sit amet -risus.
-Sed non finibus ligula. Fusce a magna auctor, molestie -nibh eget, sodales felis. Donec imperdiet facilisis mi ut -aliquam. Etiam sodales suscipit urna, eget hendrerit neque -elementum a. Vivamus fringilla sodales est ut ultricies. -Nulla convallis congue maximus. Nullam consectetur felis -vitae ultricies accumsan. Mauris at aliquam felis. Mauris -efficitur tellus massa, id ullamcorper ipsum fermentum eu. -Aenean mollis dignissim ultrices. Nunc gravida, sem sit -amet lobortis iaculis, dolor ligula convallis nibh, id -condimentum metus libero nec odio. Quisque nec ante -pretium, viverra neque nec, facilisis risus. Duis -condimentum sapien non felis cursus blandit. Integer -euismod lectus a ipsum pellentesque lacinia.
-`; - -document.getElementById("frame").contentDocument.body.innerHTML = contentHTML; -``` - -In this example, an {{HTMLElement("iframe")}} is created and filled with content, then -a specific element within the document is scrolled into view in the frame. Once that's -done, the vertical scroll position is checked by looking at the value of -`pageYOffset` in the frame's {{domxref("HTMLIFrameElement.contentWindow", - "contentWindow")}}. - -### HTML - -The HTML is extremely simple and has just two elements: an {{HTMLElement("iframe")}} -that contains the document we're going to scroll, and a {{HTMLElement("div")}} into -which we'll output the value of `pageYOffset` when we've finished the scroll. - -```html - - - -``` - -### JavaScript - -```js -const frame = document.getElementById("frame"); -const frameDoc = frame.contentDocument; -const info = document.getElementById("info"); - -const target = frameDoc.getElementById("overview"); -frameDoc.scrollingElement.scrollTop = target.offsetTop; - -info.innerText = `Y offset after scrolling: ${frame.contentWindow.pageYOffset} pixels`; -``` - -The JavaScript code begins by getting into `frame` and `info` the -`