getScreenCTM() on WebKit does not reflect transformations applied to an ancestor (see bug https://bugs.webkit.org/show_bug.cgi?id=209220), so instead of transforming the root <svg> element, we can only transform a child element
20 lines
539 B
HTML
20 lines
539 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>SVG Element Pan & Zoom Demo</title>
|
|
<link rel="stylesheet" href="assets/css/style.css">
|
|
</head>
|
|
<body>
|
|
<h1>Pan & Zoom SVG Element with CSS/JavaScript</h1>
|
|
|
|
<p>
|
|
Click and drag the image to pan. Use the mouse wheel to zoom in and out.
|
|
</p>
|
|
|
|
<object type="image/svg+xml" data="assets/images/image.svg"></object>
|
|
<script src="app.js"></script>
|
|
</body>
|
|
</html>
|