add document, fix tooltip position issue
This commit is contained in:
44
lib/ui/tooltip.html
Normal file
44
lib/ui/tooltip.html
Normal file
@ -0,0 +1,44 @@
|
||||
<div>
|
||||
<h1>tooltip</h1>
|
||||
<hr />
|
||||
<p>
|
||||
给某个元素或者页面上含有 title 属性的元素设置一个统一样式的 tooltip。
|
||||
</p>
|
||||
<h2>setTooltip</h2>
|
||||
<code>function setTooltip(container: HTMLElement, content: string | HTMLElement): void</code>
|
||||
<h3>container: HTMLElement</h3>
|
||||
<p>
|
||||
要设置 tooltip 的元素
|
||||
</p>
|
||||
<h3>content: string | HTMLElement</h3>
|
||||
<p>
|
||||
要设置的 tooltip 内容,允许为字符串或者 HTML 元素
|
||||
</p>
|
||||
<h2>resolveTooltip</h2>
|
||||
<code>function resolveTooltip(container: HTMLElement): HTMLElement</code>
|
||||
<h3>container: HTMLElement</h3>
|
||||
<p>
|
||||
给此元素下的所有含有 title 属性的子元素设置成统一样式的 tooltip
|
||||
</p>
|
||||
<h2>示例</h2>
|
||||
<pre>
|
||||
<div id="tooltip-sample">
|
||||
<blockquote title="From MDN Website">To send an HTTP request, create an XMLHttpRequest object, open a URL, and
|
||||
send the request. After the transaction completes, the object will contain useful information such as the
|
||||
response body and the HTTP status of the result.</blockquote>
|
||||
<button title="Test to send request through XMLHttpRequest.">Test</button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
window["lib-ui"].resolveCheckbox(document.querySelector("#checkbox-sample"));
|
||||
</script></pre>
|
||||
<div id="tooltip-sample">
|
||||
<blockquote title="From MDN Website">To send an HTTP request, create an XMLHttpRequest object, open a URL, and
|
||||
send the request. After the transaction completes, the object will contain useful information such as the
|
||||
response body and the HTTP status of the result.</blockquote>
|
||||
<button title="Test to send request through XMLHttpRequest.">Test</button>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
window["lib-ui"].resolveTooltip(document.querySelector("#tooltip-sample"));
|
||||
</script>
|
||||
</div>
|
Reference in New Issue
Block a user