在 IE 11 中单击时无法显示多个工具提示
Unable to show multiple tooltips upon click in IE 11
请帮助解决以下问题。
我试图在单击按钮时显示多个工具提示,并在单击第二次按钮时隐藏它们。出于某种原因,我无法在 IE 11 中执行此操作。在我提供的示例中,默认情况下我可以在页面加载时完美显示它们。一旦我尝试在点击时执行此操作(代码被注释掉),什么也没有发生。
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h3>Demo</h3>
<a href="#" data-toggle="tooltip" title="Tooltip is visible!">Tooltip will be visible here</a>
<a href="#" data-toggle="tooltip" title="Tooltip is visible!">Tooltip will be visible here</a>
<div>
<button type="button" class="btn btn-primary">Show Tooltip</button>
<button type="button" class="btn btn-default">Hide Tooltip</button>
</div>
</div>
<script>
//works fine I can see tooltips by default
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='tooltip']").tooltip('show');
$(document).ready(function () {
$(".btn-primary").click(function () {
// doesn't work for some reson
// $("[data-toggle='tooltip']").tooltip();
// $("[data-toggle='tooltip']").tooltip('show');
});
$(".btn-default").click(function(){
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='tooltip']").tooltip('hide');
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h3>Demo</h3>
<a href="#" data-toggle="tooltip" title="Tooltip is visible!">Tooltip will be visible here</a>
<a href="#" data-toggle="tooltip" title="Tooltip is visible!">Tooltip will be visible here</a>
<div>
<button type="button" class="btn btn-primary">Show Tooltip</button>
<button type="button" class="btn btn-default">Hide Tooltip</button>
</div>
</div>
<script>
//make sure to comment this lines
//works fine I can see tooltips by default
// $("[data-toggle='tooltip']").tooltip();
// $("[data-toggle='tooltip']").tooltip('show');
$(document).ready(function () {
$(".btn-primary").click(function () {
// works fine on IE11
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='tooltip']").tooltip('show');
});
$(".btn-default").click(function(){
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='tooltip']").tooltip('hide');
});
});
</script>
</body>
</html>
请帮助解决以下问题。 我试图在单击按钮时显示多个工具提示,并在单击第二次按钮时隐藏它们。出于某种原因,我无法在 IE 11 中执行此操作。在我提供的示例中,默认情况下我可以在页面加载时完美显示它们。一旦我尝试在点击时执行此操作(代码被注释掉),什么也没有发生。
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h3>Demo</h3>
<a href="#" data-toggle="tooltip" title="Tooltip is visible!">Tooltip will be visible here</a>
<a href="#" data-toggle="tooltip" title="Tooltip is visible!">Tooltip will be visible here</a>
<div>
<button type="button" class="btn btn-primary">Show Tooltip</button>
<button type="button" class="btn btn-default">Hide Tooltip</button>
</div>
</div>
<script>
//works fine I can see tooltips by default
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='tooltip']").tooltip('show');
$(document).ready(function () {
$(".btn-primary").click(function () {
// doesn't work for some reson
// $("[data-toggle='tooltip']").tooltip();
// $("[data-toggle='tooltip']").tooltip('show');
});
$(".btn-default").click(function(){
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='tooltip']").tooltip('hide');
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h3>Demo</h3>
<a href="#" data-toggle="tooltip" title="Tooltip is visible!">Tooltip will be visible here</a>
<a href="#" data-toggle="tooltip" title="Tooltip is visible!">Tooltip will be visible here</a>
<div>
<button type="button" class="btn btn-primary">Show Tooltip</button>
<button type="button" class="btn btn-default">Hide Tooltip</button>
</div>
</div>
<script>
//make sure to comment this lines
//works fine I can see tooltips by default
// $("[data-toggle='tooltip']").tooltip();
// $("[data-toggle='tooltip']").tooltip('show');
$(document).ready(function () {
$(".btn-primary").click(function () {
// works fine on IE11
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='tooltip']").tooltip('show');
});
$(".btn-default").click(function(){
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='tooltip']").tooltip('hide');
});
});
</script>
</body>
</html>