#2 fixed
parent
e85c00a5f3
commit
77724600d1
|
@ -65,6 +65,7 @@ div.ln-tooltip {
|
|||
}
|
||||
div.ln-tooltip[VISIBLE] {
|
||||
opacity: 1.0;
|
||||
transition: opacity 300ms linear;
|
||||
}
|
||||
|
||||
body {
|
||||
|
|
|
@ -18,21 +18,16 @@ function findTooltipData(el){
|
|||
}
|
||||
|
||||
function tooltipShow(ev,tooltip){
|
||||
if (tooltipEl.parentElement)
|
||||
if (!document.body.contains(tooltipEl))
|
||||
document.body.appendChild(tooltipEl);
|
||||
|
||||
tooltipEl.innerText = tooltip.value;
|
||||
tooltipEl.setAttribute("VISIBLE","");
|
||||
|
||||
tootlipVisible = true;
|
||||
|
||||
}
|
||||
function tooltipHide(ev,tooltip){
|
||||
tooltipEl.removeAttribute("VISIBLE");
|
||||
setTimeout(()=>{
|
||||
//document.body.removeChild(tooltipEl);
|
||||
}, 600);
|
||||
|
||||
tootlipVisible = false;
|
||||
}
|
||||
|
||||
|
@ -40,19 +35,23 @@ function tooltipMouseOver(ev){
|
|||
let tooltip = findTooltipData(ev.target);
|
||||
if (!tooltip)
|
||||
console.log(ev);
|
||||
if (tooltip.timeout)
|
||||
clearTimeout(tooltip.timeout);
|
||||
if (tootlipVisible)
|
||||
tooltipHide(ev,tooltip);
|
||||
else
|
||||
tooltip.timeout = setTimeout(() => {
|
||||
tooltipShow(ev,tooltip);
|
||||
}, tooltip.delay || 800);
|
||||
|
||||
if (tooltipEl){
|
||||
tooltipEl.style.left = `${ev.x+3}px`;
|
||||
tooltipEl.style.top = `${ev.y+3}px`;
|
||||
}
|
||||
|
||||
if (tooltip.timeout)
|
||||
clearTimeout(tooltip.timeout);
|
||||
if (tootlipVisible){
|
||||
tooltip.timeout = setTimeout(() => {
|
||||
tooltipHide(ev,tooltip);
|
||||
}, (tooltip.delay ? (tooltip.delay / 4) : 200));
|
||||
} else {
|
||||
tooltip.timeout = setTimeout(() => {
|
||||
tooltipShow(ev,tooltip);
|
||||
}, tooltip.delay || 800);
|
||||
}
|
||||
}
|
||||
|
||||
function tooltipMouseOut(ev){
|
||||
|
|
Loading…
Reference in New Issue