tooltip.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <link rel="stylesheet" href="../../../dist/css/bootstrap.min.css">
  7. <title>Tooltip</title>
  8. <style>
  9. #target {
  10. border: 1px solid;
  11. width: 100px;
  12. height: 50px;
  13. border: 1px solid;
  14. margin-left: 50px;
  15. -webkit-transform: rotate(270deg);
  16. -ms-transform: rotate(270deg);
  17. transform: rotate(270deg);
  18. margin-top: 100px;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <div class="container">
  24. <h1>Tooltip <small>Bootstrap Visual Test</small></h1>
  25. <p class="text-muted">Tight pants next level keffiyeh <a href="#" data-toggle="tooltip" title="Default tooltip">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" data-toggle="tooltip" title="Another tooltip">have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan <a href="#" data-toggle="tooltip" title="Another one here too">whatever keytar</a>, scenester farm-to-table banksy Austin <a href="#" data-toggle="tooltip" title="The last tip!">twitter handle</a> freegan cred raw denim single-origin coffee viral.</p>
  26. <hr>
  27. <div class="row">
  28. <p>
  29. <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="auto" title="Tooltip on auto">
  30. Tooltip on auto
  31. </button>
  32. <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
  33. Tooltip on top
  34. </button>
  35. <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="right" title="Tooltip on right">
  36. Tooltip on right
  37. </button>
  38. <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">
  39. Tooltip on bottom
  40. </button>
  41. <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="left" title="Tooltip on left">
  42. Tooltip on left
  43. </button>
  44. </p>
  45. </div>
  46. <div class="row">
  47. <p>
  48. <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="left" title="Tooltip with XSS" data-container="<img src=1 onerror=alert(123) />">
  49. Tooltip with XSS
  50. </button>
  51. <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="left" title="Tooltip with container (selector)" data-container="#customContainer">
  52. Tooltip with container (selector)
  53. </button>
  54. <button id="tooltipElement" type="button" class="btn btn-secondary" data-placement="left" title="Tooltip with container (element)">
  55. Tooltip with container (element)
  56. </button>
  57. <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-html="true" title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
  58. Tooltip with HTML
  59. </button>
  60. </p>
  61. </div>
  62. <div class="row">
  63. <div class="col-sm-3">
  64. <div id="target" title="Test tooltip on transformed element"></div>
  65. </div>
  66. <div id="shadow" class="pt-5"></div>
  67. </div>
  68. <div id="customContainer"></div>
  69. </div>
  70. <script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
  71. <script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
  72. <script src="../../dist/util.js"></script>
  73. <script src="../../dist/tooltip.js"></script>
  74. <script>
  75. $(function () {
  76. if (typeof document.body.attachShadow === 'function') {
  77. var shadowRoot = $('#shadow')[0].attachShadow({ mode: 'open' })
  78. shadowRoot.innerHTML =
  79. '<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top in a shadow dom">' +
  80. ' Tooltip on top in a shadow dom' +
  81. '</button>' +
  82. '<button id="secondTooltip" type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top in a shadow dom with container option">' +
  83. ' Tooltip on top in a shadow dom' +
  84. '</button>'
  85. $(shadowRoot.firstChild).tooltip()
  86. $(shadowRoot.getElementById('secondTooltip')).tooltip({
  87. container: shadowRoot
  88. })
  89. }
  90. $('[data-toggle="tooltip"]').tooltip()
  91. $('#tooltipElement').tooltip({
  92. container: $('#customContainer')[0]
  93. })
  94. $('#target').tooltip({
  95. placement : 'top',
  96. trigger : 'manual'
  97. }).tooltip('show')
  98. })
  99. </script>
  100. </body>
  101. </html>