I am looking to create a tooltip that displays its content after clicking on the tooltip tip icon. Currently, it only works on hover, but I want it to be clickable and mobile responsive.
Desktop design should resemble: https://i.sstatic.net/FQPyt.png
Mobile design should look like:
https://i.sstatic.net/rwkAi.png
Is there an alternative method to achieve this with my current code or another approach?
.tooltip-inner{
max-width: 527px;
/* width: 600px; */
padding:10px 15px;
color:#212121;
text-align:center;
background: #fff;
font-size: 16px;
line-height: 23px;
font-family: Arial;
border: 2px solid #D6D6D6;
-webkit-border-radius:9px;
-moz-border-radius:9px;
border-radius:6px;
text-align: left;
position: relative;
}
.tooltip.bs-tooltip-auto[x-placement^=right] .arrow::before, .tooltip.bs-tooltip-right .arrow::before,
.tooltip.bs-tooltip-auto[x-placement^=right] .arrow::after, .tooltip.bs-tooltip-right .arrow::after {
right: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
margin-left: -50px;
}
.tooltip.bs-tooltip-auto[x-placement^=right] .arrow::after, .tooltip.bs-tooltip-right .arrow::after {
border-color: rgba(136, 183, 213, 0);
border-right-color: #fff;
border-width: 15px;
margin-top: -15px;
}
.tooltip.bs-tooltip-auto[x-placement^=right] .arrow::before, .tooltip.bs-tooltip-right .arrow::before {
border-color: rgba(214, 214, 214, 0);
border-right-color: #D6D6D6;
border-width: 18px;
margin-top: -18px;
}
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>
<a style="position:relative;" class="text-dark" data-toggle="tooltip" data-html="true" data-placement="right" title="The email address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by email.">
Hover here
</a>
<h1>Dummy text</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</body>
</html>