Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5049b83
commit e67a860
Showing
11 changed files
with
222 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Mouse](./puppeteer.mouse.md) > [wheel](./puppeteer.mouse.wheel.md) | ||
|
||
## Mouse.wheel() method | ||
|
||
Dispatches a `mousewheel` event. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
wheel(options?: MouseWheelOptions): Promise<void>; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| options | [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | Optional: <code>MouseWheelOptions</code>. | | ||
|
||
<b>Returns:</b> | ||
|
||
Promise<void> | ||
|
||
## Example | ||
|
||
An example of zooming into an element: | ||
|
||
```js | ||
await page.goto('https://mdn.mozillademos.org/en-US/docs/Web/API/Element/wheel_event$samples/Scaling_an_element_via_the_wheel?revision=1587366'); | ||
|
||
const elem = await page.$('div'); | ||
const boundingBox = await elem.boundingBox(); | ||
await page.mouse.move( | ||
boundingBox.x + boundingBox.width / 2, | ||
boundingBox.y + boundingBox.height / 2 | ||
); | ||
|
||
await page.mouse.wheel({ deltaY: -100 }) | ||
|
||
``` | ||
|
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [MouseWheelOptions](./puppeteer.mousewheeloptions.md) > [deltaX](./puppeteer.mousewheeloptions.deltax.md) | ||
|
||
## MouseWheelOptions.deltaX property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
deltaX?: number; | ||
``` |
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,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [MouseWheelOptions](./puppeteer.mousewheeloptions.md) > [deltaY](./puppeteer.mousewheeloptions.deltay.md) | ||
|
||
## MouseWheelOptions.deltaY property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
deltaY?: number; | ||
``` |
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,20 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | ||
|
||
## MouseWheelOptions interface | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface MouseWheelOptions | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [deltaX](./puppeteer.mousewheeloptions.deltax.md) | number | | | ||
| [deltaY](./puppeteer.mousewheeloptions.deltay.md) | number | | | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<style> | ||
body { | ||
min-height: 100vh; | ||
margin: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
div { | ||
width: 105px; | ||
height: 105px; | ||
background: #cdf; | ||
padding: 5px; | ||
} | ||
</style> | ||
<title>Element: wheel event - Scaling_an_element_via_the_wheel - code sample</title> | ||
</head> | ||
<body> | ||
<div>Scale me with your mouse wheel.</div> | ||
<script> | ||
function zoom(event) { | ||
event.preventDefault(); | ||
|
||
scale += event.deltaY * -0.01; | ||
|
||
// Restrict scale | ||
scale = Math.min(Math.max(.125, scale), 4); | ||
|
||
// Apply scale transform | ||
el.style.transform = `scale(${scale})`; | ||
} | ||
|
||
let scale = 1; | ||
const el = document.querySelector('div'); | ||
el.onwheel = zoom; | ||
</script> | ||
</body> | ||
</html> |
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