mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-05 17:24:20 +01:00
113 lines
5.3 KiB
HTML
113 lines
5.3 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="../../../dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<title>Tooltip</title>
|
|
<style>
|
|
#target {
|
|
border: 1px solid;
|
|
width: 100px;
|
|
height: 50px;
|
|
margin-left: 50px;
|
|
transform: rotate(270deg);
|
|
margin-top: 100px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Tooltip <small>Bootstrap Visual Test</small></h1>
|
|
|
|
<p class="text-muted">Tight pants next level keffiyeh <a href="#" data-bs-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-bs-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-bs-toggle="tooltip" title="Another one here too">whatever keytar</a>, scenester farm-to-table banksy Austin <a href="#" data-bs-toggle="tooltip" title="The last tip!">twitter handle</a> freegan cred raw denim single-origin coffee viral.</p>
|
|
|
|
<hr>
|
|
|
|
<div class="row">
|
|
<p>
|
|
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="auto" title="Tooltip on auto">
|
|
Tooltip on auto
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" title="Tooltip on top">
|
|
Tooltip on top
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="right" title="Tooltip on right">
|
|
Tooltip on end
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Tooltip on bottom">
|
|
Tooltip on bottom
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="left" title="Tooltip on left">
|
|
Tooltip on start
|
|
</button>
|
|
</p>
|
|
</div>
|
|
<div class="row">
|
|
<p>
|
|
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="left" title="Tooltip with XSS" data-bs-container="<img src=1 onerror=alert(123)>">
|
|
Tooltip with XSS
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="left" title="Tooltip with container (selector)" data-bs-container="#customContainer">
|
|
Tooltip with container (selector)
|
|
</button>
|
|
<button id="tooltipElement" type="button" class="btn btn-secondary" data-bs-placement="left" title="Tooltip with container (element)">
|
|
Tooltip with container (element)
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-html="true" title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
|
|
Tooltip with HTML
|
|
</button>
|
|
</p>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<div id="target" title="Test tooltip on transformed element"></div>
|
|
</div>
|
|
<div id="shadow" class="pt-5"></div>
|
|
</div>
|
|
<div id="customContainer"></div>
|
|
</div>
|
|
|
|
<script src="../../../node_modules/@popperjs/core/dist/umd/popper.min.js"></script>
|
|
<script src="../../dist/dom/selector-engine.js"></script>
|
|
<script src="../../dist/dom/event-handler.js"></script>
|
|
<script src="../../dist/dom/manipulator.js"></script>
|
|
<script src="../../dist/dom/data.js"></script>
|
|
<script src="../../dist/tooltip.js"></script>
|
|
<script>
|
|
if (typeof document.body.attachShadow === 'function') {
|
|
var shadowRoot = document.getElementById('shadow').attachShadow({ mode: 'open' })
|
|
shadowRoot.innerHTML =
|
|
'<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" title="Tooltip on top in a shadow dom">' +
|
|
' Tooltip on top in a shadow dom' +
|
|
'</button>' +
|
|
'<button id="secondTooltip" type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" title="Tooltip on top in a shadow dom with container option">' +
|
|
' Tooltip on top in a shadow dom' +
|
|
'</button>'
|
|
|
|
var firstChildTooltip = new Tooltip(shadowRoot.firstChild)
|
|
var secondChildTooltip = new Tooltip(shadowRoot.getElementById('secondTooltip'), {
|
|
container: shadowRoot
|
|
})
|
|
}
|
|
|
|
[].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
|
|
.forEach(function (tooltip) {
|
|
new Tooltip(tooltip)
|
|
})
|
|
|
|
var tooltipElement = document.getElementById('tooltipElement')
|
|
var tooltipElementInstance = new Tooltip(tooltipElement, {
|
|
container: document.getElementById('customContainer')
|
|
})
|
|
|
|
var target = document.getElementById('target')
|
|
var targetTooltip = new Tooltip(target, {
|
|
placement : 'top',
|
|
trigger : 'manual'
|
|
})
|
|
targetTooltip.show()
|
|
</script>
|
|
</body>
|
|
</html>
|