如何将弹出工具提示放在第一个和第二个按钮上?
@event.listens_for(Engine, "connect")
def _set_sqlite_pragma(dbapi_connection, connection_record):
if isinstance(dbapi_connection, SQLite3Connection):
cursor = dbapi_connection.cursor()
cursor.execute("PRAGMA foreign_keys=ON;")
cursor.close()
我需要像工具提示这样的东西"这是第一个按钮"
答案 0 :(得分:0)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example of Bootstrap Popover with Close Button</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('[data-toggle="popover"]').popover({
placement : 'top',
html : true,
title : 'User Info <a href="#" class="close" data-dismiss="alert">×</a>',
content : '<div class="media"><a href="#" class="pull-left"><img src="../images/avatar-tiny.jpg" class="media-object" alt="Sample Image"></a><div class="media-body"><h4 class="media-heading">Jhon Carter</h4><p>Excellent Bootstrap popover! I really love it.</p></div></div>'
});
$(document).on("click", ".popover .close" , function(){
$(this).parents(".popover").popover('hide');
});
});
</script>
<style type="text/css">
.bs-example{
margin: 200px 150px 0;
}
.popover-title .close{
position: relative;
bottom: 3px;
}
</style>
</head>
<body>
<div class="bs-example">
<button type="button" class="btn btn-primary" data-toggle="popover">First </button>
<br/> <br/>
<button type="button" class="btn btn-primary" data-toggle="popover">Second </button>
</div>
</body>
</html>
答案 1 :(得分:0)
如tooltips中所述,您需要添加
data-toggle="tooltip"
title="...."
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-1.12.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="btn-group pull-right" data-toggle="buttons" style="top:26px;z-index:2;">
<label class="make-small btn btn-default" id="first_button_func" data-toggle="tooltip" title="Tooltip test for First Button">
<span>First Button</span>
</label>
<label class="make-small filter-column btn btn-default active" data-toggle="tooltip" title="Tooltip test for Second Button">
<input type="checkbox" autocomplete="off" checked=""> <span>Second Button</span>
</label>
</div>
答案 2 :(得分:0)
<div class="btn-group pull-right" data-toggle="buttons" style="top:26px;z-index:2;">
<label class="make-small btn btn-default" id="first_button_func">
<span data-toggle="tooltip" data-placement="left" title="This is the first button">First Button</span>
</label>
<label class="make-small filter-column btn btn-default active">
<input data-toggle="tooltip" data-placement="left" title="This is the second button" type="checkbox" autocomplete="off" checked=""> <span>Second Button</span>
</label>
</div>
这个添加到js文件...
$('[data-toggle="tooltip"]').tooltip();