| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <title>Tooltip Visual Test: Default</title> |
| 6 | <link rel="stylesheet" href="../../../themes/base/all.css"> |
| 7 | <style> |
| 8 | .group { |
| 9 | margin-top: 2em; |
| 10 | } |
| 11 | </style> |
| 12 | <script src="../../../external/requirejs/require.js"></script> |
| 13 | <script src="../../../demos/bootstrap.js" data-modules="button"> |
| 14 | // default |
| 15 | $( "#context1, form, #childish, #nested-input" ).tooltip(); |
| 16 | |
| 17 | // Custom class, replaces ui-widget-content |
| 18 | $( "#context2" ).tooltip({ |
| 19 | classes: { |
| 20 | "ui-tooltip": "ui-corner-all ui-widget-header" |
| 21 | } |
| 22 | }); |
| 23 | $( "#right1" ).tooltip({ |
| 24 | classes: { |
| 25 | "ui-tooltip": "ui-corner-all ui-state-error" |
| 26 | } |
| 27 | }); |
| 28 | |
| 29 | // Synchronous content |
| 30 | $( "#footnotes" ).tooltip({ |
| 31 | items: "[href^='#']", |
| 32 | content: function() { |
| 33 | return $( $( this ).attr( "href" ) ).html(); |
| 34 | } |
| 35 | }); |
| 36 | |
| 37 | // Asynchronous content |
| 38 | $( "#async" ).tooltip({ |
| 39 | content: function( response ) { |
| 40 | setTimeout(function() { |
| 41 | response( "I loaded <strong>asynchronously</strong>!" ); |
| 42 | }, 1000 ); |
| 43 | return "Loading..."; |
| 44 | } |
| 45 | }); |
| 46 | |
| 47 | // Asynchronous content with caching |
| 48 | var content; |
| 49 | $( "#async2" ).tooltip({ |
| 50 | content: function( response ) { |
| 51 | if ( content ) { |
| 52 | return content; |
| 53 | } |
| 54 | setTimeout(function() { |
| 55 | content = "<strong>Hello</strong> world!"; |
| 56 | response( content ); |
| 57 | }, 1000 ); |
| 58 | return "Loading..."; |
| 59 | } |
| 60 | }); |
| 61 | |
| 62 | // Custom position |
| 63 | $( "#right2" ).tooltip({ |
| 64 | classes: { |
| 65 | "ui-tooltip": "ui-corner-all ui-state-highlight" |
| 66 | }, |
| 67 | position: { |
| 68 | my: "center top", |
| 69 | at: "center bottom+10" |
| 70 | } |
| 71 | }); |
| 72 | |
| 73 | $( "#button1" ).button(); |
| 74 | $( "#button2" ).button({ |
| 75 | icon: "ui-icon-wrench" |
| 76 | }); |
| 77 | $( "#button3, #button4" ).button({ |
| 78 | icon: "ui-icon-wrench", |
| 79 | showLabel: false |
| 80 | }); |
| 81 | $( "#buttons" ).tooltip({ |
| 82 | position: { |
| 83 | my: "center bottom", |
| 84 | at: "center top-5" |
| 85 | } |
| 86 | }); |
| 87 | |
| 88 | $( "#blurs-on-click" ).tooltip({ |
| 89 | track: true, |
| 90 | show: { |
| 91 | delay: 500 |
| 92 | } |
| 93 | }).on( "click", function() { |
| 94 | $( "#focus-on-me" ).trigger( "focus" ); |
| 95 | }); |
| 96 | </script> |
| 97 | </head> |
| 98 | <body> |
| 99 | |
| 100 | <div> |
| 101 | <p>Lots of tooltipped elements close together.<br> |
| 102 | Mouse through them quickly and slowly.</p> |
| 103 | <ul id="context1"> |
| 104 | <li><a href="#" title="Tooltip text 1">Anchor 1</a></li> |
| 105 | <li><a href="#" title="Tooltip text 2">Anchor 2</a></li> |
| 106 | <li><a href="#" title="Tooltip text 3">Anchor 3</a></li> |
| 107 | <li><a href="#" title="Tooltip text 4 more Tooltip text Tooltip text ">Anchor 4</a></li> |
| 108 | <li><a href="#" title="Tooltip text 5 more Tooltip text Tooltip text ">Anchor 5</a></li> |
| 109 | <li><a href="#" title="Tooltip text 6 more Tooltip text Tooltip text ">Anchor 6</a></li> |
| 110 | </ul> |
| 111 | |
| 112 | <div class="group" style="position: absolute; right: 1em; text-align: right;"> |
| 113 | <p>These elements are right aligned.<br> |
| 114 | One collides and one uses custom position.</p> |
| 115 | <p id="right1" title="right aligned element"> |
| 116 | collision detection should kick in around here |
| 117 | </p> |
| 118 | <p id="right2" title="right aligned element with custom position"> |
| 119 | right aligned with custom position |
| 120 | </p> |
| 121 | </div> |
| 122 | |
| 123 | <div class="group"> |
| 124 | <p>These footnotes pull content form the elements they link to.</p> |
| 125 | <div id="footnotes"> |
| 126 | <a href="#footnote1">I'm a link to a footnote.</a> |
| 127 | <a href="#footnote2">I'm another link to a footnote.</a> |
| 128 | </div> |
| 129 | </div> |
| 130 | |
| 131 | <div class="group"> |
| 132 | <p>These elements load their content asynchronously.<br> |
| 133 | There should be a loading message while the content is retrieved.</p> |
| 134 | <div id="async" style="width: 100px;" class="ui-widget-content" title="never be seen"> |
| 135 | async |
| 136 | </div> |
| 137 | <div id="async2" style="width: 100px;" class="ui-widget-content" title="never be seen"> |
| 138 | async + cache |
| 139 | </div> |
| 140 | </div> |
| 141 | |
| 142 | <div class="group" style="width: 300px;"> |
| 143 | <p>Nested elements.</p> |
| 144 | <div id="context2"> |
| 145 | <div title="nested parent" style="border:1px solid red;"> |
| 146 | tooltipped |
| 147 | <span title="nested child" style="border:1px solid green; padding-left: 25px;"> |
| 148 | nested tooltipped |
| 149 | <span title="nested nested child" style="border:1px solid blue; padding-left: 25px;">third level</span> |
| 150 | </span> |
| 151 | </div> |
| 152 | <input title="nested input title"> |
| 153 | </div> |
| 154 | <div id="childish" style="border: 1px solid black;" title="element with child elements"> |
| 155 | Text in <strong>bold</strong>. |
| 156 | </div> |
| 157 | </div> |
| 158 | |
| 159 | <button id="blurs-on-click" title="button title text">click me to focus something else</button> |
| 160 | <input id="focus-on-me"> |
| 161 | |
| 162 | <div class="group"> |
| 163 | <p>Play around with focusing and hovering of form elements.</p> |
| 164 | <form> |
| 165 | <div> |
| 166 | <label for="first">First Name:</label> |
| 167 | <input id="first" title="Your first name is optional"> |
| 168 | </div> |
| 169 | <div> |
| 170 | <label for="last">Last Name:</label> |
| 171 | <input id="last" title="Your last name is optional"> |
| 172 | </div> |
| 173 | </form> |
| 174 | |
| 175 | <p>Some inputs nested inside labels:</p> |
| 176 | <div id="nested-input"> |
| 177 | <label title="test"><input type="checkbox">This is a test</label> |
| 178 | <label title="test2"><input type="checkbox">This is a test</label> |
| 179 | <label><input type="checkbox" title="test3">This is a test</label> |
| 180 | <label><input type="checkbox" title="test4">This is a test</label> |
| 181 | </div> |
| 182 | |
| 183 | <p>Some button widgets:</p> |
| 184 | <div id="buttons"> |
| 185 | <button id="button1" title="Button Tooltip">Button Label</button> |
| 186 | <button id="button2" title="Icon Button">Button with Icon</button> |
| 187 | <button id="button3">Icon Only Button 1</button> |
| 188 | <button id="button4">Icon Only Button 2</button> |
| 189 | </div> |
| 190 | </div> |
| 191 | |
| 192 | <div class="group"> |
| 193 | <div id="footnote1">This is <strong>the</strong> footnote, including other elements</div> |
| 194 | <div id="footnote2">This is <strong>the other</strong> footnote, including other elements</div> |
| 195 | </div> |
| 196 | </div> |
| 197 | |
| 198 | <div style="height: 2000px"></div> |
| 199 | |
| 200 | </body> |
| 201 | </html> |