Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
blob: 80404219d26190dcd81449f8e365af3e0b42b117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>SVG Pan & Zoom Example</title>
    <style>
      body {
        text-align: center;
        max-width: 100vw;
      }

      object {
        max-height: 400px;
        max-width: 100%;
        background-color: lightsteelblue;
        border: 1px solid steelblue;
        touch-action: none;
      }
    </style>
  </head>
  <body>
    <h1>Pan & Zoom an SVG Image with JavaScript</h1>

    <p>
      Click and drag on the image to pan. Use the mouse wheel
      to zoom in and out.
    </p>

    <object type="image/svg+xml" data="image.svg"></object>
    <script src="app.js"></script>
  </body>
</html>