滚轮控制缩放

mac2025-08-10  10

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="zoom/zoomify.min.css"> <title>Document</title> <style> *{ margin: 0; } body{ overflow: hidden; } img{ width: 300px; height: 300px; } </style> </head> <body> <img id="oImage" src="WechatIMG11.jpg" onmousewheel=" return picture()" style="cursor:pointer" /> <script> var count = 10; function picture(){ count = Counting(count); Resize(count); } function Counting(count){ if(event.wheelDelta>=120){ count++; }else if(event.wheelDelta<=-120){ count--; } return count; } function Resize(count){ oImage.style.zoom = count+'0%'; // oCounter.innerText = count+'0%'; } </script> </body> </html>
最新回复(0)