-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add visual viewport scrollend event ref page (#34427)
* Add visual viewport scrollend event ref page * correct scrollend linking errors * Fix for wbamberg review comment * Added useful example and better use case explanations * fixes for wbamberg 2nd round review comments * Update code explanation as the demo has changed * Update files/en-us/web/api/visual_viewport_api/index.md Co-authored-by: wbamberg <[email protected]> * Last few fixes for wbamberg comments --------- Co-authored-by: wbamberg <[email protected]>
- Loading branch information
1 parent
9380313
commit 4b5b3e1
Showing
5 changed files
with
120 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
files/en-us/web/api/visualviewport/scrollend_event/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: "VisualViewport: scrollend event" | ||
short-title: scrollend | ||
slug: Web/API/VisualViewport/scrollend_event | ||
page-type: web-api-event | ||
browser-compat: api.VisualViewport.scrollend_event | ||
--- | ||
|
||
{{APIRef("Visual Viewport")}} | ||
|
||
The **`scrollend`** event of the {{domxref("VisualViewport")}} interface is fired when a scrolling operation on the visual viewport ends. This allows you to update an element when a scrolling action is completed. For example, you could use the {{domxref("VisualViewport/resize_event", "resize")}} and {{domxref("VisualViewport/scroll_event", "scroll")}} events to keep an element fixed to the visual viewport as it is pinch-zoomed and scrolled, and update it with new content when scrolling ends using `scrollend`. | ||
|
||
## Syntax | ||
|
||
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property. | ||
|
||
```js | ||
addEventListener("scrollend", (event) => {}); | ||
|
||
onscrollend = (event) => {}; | ||
``` | ||
|
||
## Event type | ||
|
||
A generic {{domxref("Event")}}. | ||
|
||
## Examples | ||
|
||
See the [Visual Viewport API](/en-US/docs/Web/API/Visual_Viewport_API#examples) landing page for a usage demo. | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} |