mgn-tip
Implement tooltips function.
https://github.com/frontend-isobar-jp/mgn-tip
Default
left
LEFT
top
TOP
right
RIGHT
bottom
BOTTOM
let tip = new mgnTip(
".j-tip",
{
fadeSpeed: 100
}
);
tip.ShowEnd = function(){
console.log("ShowEnd");
};
<div class="j-tip">
<a class="j-tip_btn" data-direction="top">top</a>
<div class="j-tip_detail">TOP</div>
</div>
.j-tip a {
padding: 15px 40px;
display: inline-block;
background: #999;
color: #FFF;
line-height: 1;
text-align: center;
border-radius: 2px;
text-decoration: none;
}
.j-tip_detail {
padding: 8px 8px 7px;
border: 1px solid #000;
background: #FFF;
border-radius: 2px;
z-index: 10;
line-height: 1;
}
.j-tip_detail:before {
content: "";
display: block;
width: 0;
height: 0;
position: absolute;
}
.j-tip_detail.left:before {
border-bottom: 4px solid transparent;
border-left: 6px solid #000;
border-top: 4px solid transparent;
top: 50%;
right: 0;
margin: -4px -6px 0 0;
}
.j-tip_detail.top:before {
border-top: 6px solid #000;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
bottom: -6px;
left: 10px;
}
.j-tip_detail.right:before {
border-bottom: 4px solid transparent;
border-right: 6px solid #000;
border-top: 4px solid transparent;
top: 50%;
left: 0;
margin: -4px 0 0 -6px;
}
.j-tip_detail.bottom:before {
border-bottom: 6px solid #000;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
top: -6px;
left: 10px;
}