JSFiddle - React, Tailwind, and code Playground
by 2Yootz
HTML
<div class="shareaholic-tipsy shareaholic-tpsy-n" style="top: 500px;left:439px; visibility:visible;display:block;opacity:1;">
<div class="shareaholic-tipsy-arrow shareaholic-tipsy-arrow-n"></div>
<div class="shareaholic-tipsy-inner">Twitter</div>
</div>
<br />
<br />
<br />
<br />
<br />This is a sample sentence. <a href="javascript:void(0);">Test</a>
CSS
.shareaholic-tipsy {
font-size: 12px;
position: absolute;
padding: 5px;
z-index: 100000;
font-family:'lucida grande', tahoma, verdana, arial, sans-serif
}
.shareaholic-tipsy-inner {
background-color: #000;
color: #FFF;
max-width: 200px;
padding: 3px 8px 3px 8px;
text-align: center
}
.shareaholic-tipsy-inner {
line-height: 1;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px
}
.shareaholic-tipsy-arrow {
position: absolute;
width: 0;
height: 0;
line-height: 0;
border: 5px dashed #000
}
.shareaholic-tipsy-arrow-n {
border-bottom-color: #000
}
.shareaholic-tipsy-arrow-s {
border-top-color: #000
}
.shareaholic-tipsy-arrow-e {
border-left-color: #000
}
.shareaholic-tipsy-arrow-w {
border-right-color: #000
}
.shareaholic-tipsy-n .shareaholic-tipsy-arrow {
top: 0px;
left: 50%;
margin-left: -5px;
border-bottom-style: solid;
border-top: none;
border-left-color: transparent;
border-right-color: transparent
}
.shareaholic-tipsy-nw .shareaholic-tipsy-arrow {
top: 0;
left: 10px;
border-bottom-style: solid;
border-top: none;
border-left-color: transparent;
border-right-color: transparent
}
.shareaholic-tipsy-ne .shareaholic-tipsy-arrow {
top: 0;
right: 10px;
border-bottom-style: solid;
border-top: none;
border-left-color: transparent;
border-right-color: transparent
}
.shareaholic-tipsy-s .shareaholic-tipsy-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-top-style: solid;
border-bottom: none;
border-left-color: transparent;
border-right-color: transparent
}
.shareaholic-tipsy-sw .shareaholic-tipsy-arrow {
bottom: 0;
left: 10px;
border-top-style: solid;
border-bottom: none;
border-left-color: transparent;
border-right-color: transparent
}
.shareaholic-tipsy-se .shareaholic-tipsy-arrow {
bottom: 0;
right: 10px;
...
JavaScript
function (e) {
function t(e, t) {
return "function" == typeof e ? e.call(t) : e
}
function i(e) {
for (; e = e.parentNode;) if (e == document) return !0;
return !1
}
function n(t, i) {
this.$element = e(t), this.options = i, this.enabled = !0, this.fixTitle()
}
var r = "shareaholic-tipsy";
n.prototype = {
show: function () {
this.enabled = !this.$element.hasClass("ui-sortable-helper");
var i = this.getTitle();
if (i && this.enabled) {
var n = this.tip();
n.find("." + r + "-inner")[this.options.html ? "html" : "text"](i), this.options.className && n.addClass(t(this.options.className, this.$element[0])), n.remove().css({
top: 0,
left: 0,
visibility: "hidden",
display: "block"
}).prependTo(document.body);
var o, s = e.extend({}, this.$element.offset(), {
width: this.$element[0].offsetWidth,
height: this.$element[0].offsetHeight
}),
a = n[0].offsetWidth,
l = n[0].offsetHeight,
c = t(this.options.gravity, this.$element[0]);
switch (c.charAt(0)) {
case "n":
o = {
top: s.top + s.height + this.options.offset,
left: s.left + s.width / 2 - a / 2
};
break;
case "s":
o = {
top: s.top - l - this.options.offset,
left: s.left + s.width / 2 - a / 2
};
break;
case "e":
o = {
top: s.top + s.height / 2 - l / 2,
...