aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/demos/tooltip.html
blob: 7b6f743b4edcbed948016fc7f542326373e4f22a (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<!--
Copyright 2010 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
  <title>goog.ui.Tooltip</title>
  <meta charset="utf-8">
  <script src="../base.js"></script>
  <script>
    goog.require('goog.ui.Tooltip');
  </script>
  <link rel="stylesheet" href="css/demo.css">
  <style>
    .goog-tooltip {
      background: infobackground;
      color: infotext;
      border: 1px solid infotext;
      padding: 1px;
      font: menu;
    }
    .tooltip2 {
      background: #C0C0FF;
      color: infotext;
      border: 1px solid infotext;
      padding: 1px;
      font: menu;
      width: 120px;
    }
    span {
      border-bottom: 1px dotted black;
    }
  </style>
  </head>
<body>
  <h1>goog.ui.Tooltip</h1>
  <p>
    <button id="btn1">Hover me</button>
    <button id="btn2">and me</button>
    <button id="btn3">and me</button>
    <button id="btnNoTooltip">but not me</button>
  </p>

  <p>
    Demo <span id="txt1">tooltips</span> in text and and of <span id="txt2">nested
    <span id="txt3">tooltips</span>, where an element triggers
    one tooltip and an element inside the first element triggers another
    one.</span>
  </p>

  <div style="overflow: auto; height: 100px; border: 1px solid black;">
  <div style="margin: 5px; padding: 5px; height: 200px;">
    <button id="btn4">and me too!</button>
  </div>
  </div>

  <button id="btn5" style="position: absolute; bottom: 5px;">near bottom</button>

  <script>
    var msg1 = "Tooltip widget. Appears next to the cursor when over an " +
      "attached element or next to the element if it's active.";
    var tooltip1 = new goog.ui.Tooltip('btn1', msg1);

    var tooltip2 = new goog.ui.Tooltip('btn2');
    tooltip2.className = 'tooltip2';
    tooltip2.setHtml(
      "This is message two, using a different class name for the tooltip and " +
      "<strong>HTML</strong> <em>markup</em>.<br>" +
      "<button id=\"btn-nest\">Hover me</button>", true);
    tooltip2.attach('btn5');

    var tooltip3 = new goog.ui.Tooltip('btn3', 'Tooltip for button 3');

    var msg4 = "Tooltip for button 4, demonstrating that it's positioned " +
               "correctly even when inside a scrolling container.";
    var tooltip4 = new goog.ui.Tooltip('btn4', msg4);

    var msg5 = "tooltip for the word 'tooltips'."
    var tooltip5 = new goog.ui.Tooltip('txt1', msg5);
    tooltip5.attach('txt3');

    var tooltip6 = new goog.ui.Tooltip('txt2', 'outer tooltip');

    var tooltip7 = new goog.ui.Tooltip('btn-nest');
    tooltip7.setHtml("Even nested<br>tooltips!");
  </script>
</body>
</html>