Update mousemove-no-log.html
This commit is contained in:
Родитель
9769a880bd
Коммит
a12a4ca450
|
@ -3,10 +3,30 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Logging mouse movement</title>
|
||||
<title>Mouse movement without logging</title>
|
||||
<link rel="stylesheet" href="demostyles.css">
|
||||
<link rel="shortcut icon" type="image/ico" href="favicon_io/favicon.ico"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Console demos: no logging</h1>
|
||||
|
||||
<p>There is nothing to see here, you need to open the Developer Tools and set up live expressions for x and y.</p>
|
||||
<p>Select <code>Control</code>+<code>Shift</code>+<code>J</code> (Windows, Linux) or <code>Command</code>+<code>Option</code>+<code>J</code> (macOS).</p>
|
||||
<p>Then move your mouse around the screen. Uncheck the following to stop logging.</p>
|
||||
<p><label><input type="checkbox" checked>Log mouse movement</label></p>
|
||||
<script>
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
document.addEventListener('mousemove', e => {
|
||||
x = e.x;
|
||||
y = e.y;
|
||||
if(document.querySelector('input').checked) {
|
||||
console.log({x}, {y});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче