Li *_*oyi 46 html css twitter-bootstrap
这两者有什么区别?对我来说,Popover看起来像一个更大的工具提示,边框更粗.是否有任何质的差异,或者只是你想要它有多大胆?
从语义上讲,您通常希望使用弹出窗口来提供其他相关信息。您将使用工具提示进行澄清或提示。
从技术上讲,没有太大区别。它们的工作方式相似。您可以使用data-属性或JS。
它们使用相同的库工作,因此具有许多相同的交互选项(悬停/焦点,内容包含,出现的一侧等)。
代码示例:
$(function() {
$('.favorite').tooltip({
placement: "right",
title: "Click to mark as favorite question (click again to undo)"
});
$('.demo-start').popover({
content: `
<p>Walk through the components step by step! In this guide, you'll:</p>
<ol>
<li>Learn the semantics</li>
<li>Learn the code</li>
<li>Examine use cases</li>
</ol>
<div class="btn-group text-light d-flex justify-content-end" role="group" aria-label="Navigation buttons">
<button type="button" class="btn btn-secondary" disabled><i class="fas fa-arrow-left mr-1"></i> Previous</button>
<button type="button" class="btn btn-secondary">Next <i class="fas fa-arrow-right ml-1"></i></button>
</div>
`,
html: true,
placement: 'right',
title: 'Welcome to the Tour!',
trigger: 'hover focus'
});
});Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
<a class="demo-start btn btn-dark m-5" href="#" role="button">
<i class="fas fa-play text-light mr-1"> </i> Start the Demo</a>
<br>
<i class="favorite fas fa-star m-5 text-secondary"></i>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18470 次 |
| 最近记录: |