File: svg.html

package info (click to toggle)
node-popper2 2.11.2-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,752 kB
  • sloc: javascript: 23,558; makefile: 20
file content (53 lines) | stat: -rw-r--r-- 1,111 bytes parent folder | download | duplicates (3)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html> <title>SVG Visual Test</title>

<style>
  @import '/reset.css';
  svg {
    width: 200px;
    height: 200px;
    padding: 20px;
  }

  .popper {
    width: 100px;
    height: 100px;
    background-color: rebeccapurple;
    box-shadow: inset 0 0 0 1px black;
  }
</style>

<svg
  id="reference-1"
  class="reference"
  viewBox="0 0 200 200"
  xmlns="http://www.w3.org/2000/svg"
  fill="red"
>
  <rect width="200" height="200" />
</svg>

<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
  <rect
    id="reference-2"
    class="reference"
    width="200"
    height="200"
    fill="tomato"
  />
</svg>
<div class="popper" id="popper-1">Popper Box</div>
<div class="popper" id="popper-2">Popper Box</div>

<script type="module">
  import { createPopper } from './dist/popper.js';

  const n = document.querySelectorAll('.popper').length;

  for (let i = 1; i < n + 1; i++) {
    const reference = document.querySelector(`#reference-${i}`);
    const popper = document.querySelector(`#popper-${i}`);
    createPopper(reference, popper, {
      placement: 'right',
    });
  }
</script>