JSFiddle - React, Tailwind, and code Playground

by apimenov93

HTML

<br />
<br />
<br />
<span class="tooltip_display">Trigger</span>
<div id="large">
<div class="ttip">
  <div class="contents">Here goes contents...</div>
  <span class="note">(hover and move mouse out of this box and it will close)</span> 
</div>
</div>
<div id="background"></div>

CSS

.ttip {
    position: absolute;
    width: 350px;
    height: 100px;
    color: #fff;
    padding: 20px;
    -webkit-box-shadow: 0 1px 2px #303030;
    -moz-box-shadow: 0 1px 2px #303030;
    box-shadow: 0 1px 2px #303030;
    border-radius: 8px 8px 8px 8px;
    -moz-border-radius: 8px 8px 8px 8px;
    -webkit-border-radius: 8px 8px 8px 8px;
    -o-border-radius: 8px 8px 8px 8px;
    background-image:-moz-linear-gradient(top, #F45000, #FF8000);
    background-image: -webkit-gradient(linear, left top, left bottom, from(#F45000), to(#FF8000));
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F45000', endColorstr='#FF8000', GradientType=0);
    background-color:#000;
    display: none
}
.contents {
    font-size: 15px;
    font-weight:bold
}
.note {
    font-size: 13px;
    text-align:center;
    display:block;
    width: 100%
}
#large {
    display: none;
    position: absolute;
    background: #FFFFFF;
    padding: 0px;
    z-index: 10;
    min-height: 0px;
    min-width: 0px;
    color: #336699;
}

JavaScript

$('.tooltip_display').mouseenter(function() {
    var $this = $(this);
    $("#background").css({
        "opacity": "0.3"
    }).fadeIn("slow");


    $("#large").html(function() {
        $('.ttip').css({
            left: $this.position() + '20px',
            top: $this.position() + '50px'
        }).show(500)

    }).fadeIn("slow");

});

$('.ttip').mouseleave(function() {
    $(this).hide(500);
    $("#background").fadeOut("slow");
    $("#large").fadeOut("slow");

});