summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/test/assets/input/wheel.html
diff options
context:
space:
mode:
Diffstat (limited to 'remote/test/puppeteer/test/assets/input/wheel.html')
-rw-r--r--remote/test/puppeteer/test/assets/input/wheel.html43
1 files changed, 43 insertions, 0 deletions
diff --git a/remote/test/puppeteer/test/assets/input/wheel.html b/remote/test/puppeteer/test/assets/input/wheel.html
new file mode 100644
index 0000000000..3d093a993e
--- /dev/null
+++ b/remote/test/puppeteer/test/assets/input/wheel.html
@@ -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>