summaryrefslogtreecommitdiffstats
path: root/afb-client/bower_components/tether/examples/viewport/index.html
blob: ac0711b416ab8c05d4ec1edcbb385255a205a060 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="../resources/css/base.css" />
    <link rel="stylesheet" href="./colors.css" />
    <style>
      * {
        box-sizing: border-box;
      }

      .element {
        background-color: #FFDC00;
        width: 80%;
        max-width: 300px;
        padding: 0 15px;
        font-size: 20px;
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
      }

      @media (max-width: 380px) {
        .element {
          font-size: 16px;
        }
      }

      .bit {
        width: 10vw;
        height: 10vw;
        float: left;
      }
    </style>
  </head>
  <body>
    <div class="element">
      <p>This element is tethered to the middle of the visible part of the body.</p>

      <p>Inspect the element to see how Tether decided
      to use <code>position: fixed</code>.</p>
    </div>

    <script src="../../tether.js"></script>
    <script>
      new Tether({
        element: '.element',
        target: document.body,
        attachment: 'middle center',
        targetAttachment: 'middle center',
        targetModifier: 'visible'
      });
    </script>

    <script>
      // Random colors bit, don't mind this
      colors = ['navy', 'blue', 'aqua', 'teal', 'olive', 'green', 'lime',
        'yellow', 'orange', 'red', 'fuchsia', 'purple', 'maroon'];

      curColors = null;
      for(var i=300; i--;){
        if (!curColors || !curColors.length)
          curColors = colors.slice(0);

        var bit = document.createElement('div')
        var index = (Math.random() * curColors.length)|0;
        bit.className = 'bit bg-' + curColors[index]
        curColors.splice(index, 1);
        document.body.appendChild(bit);
      }
    </script>
  </body>
</html>