I would like to add a tooltip that combines javascript values without using jquery
This is my div :
<div tooltip="Should be forceBase + modifyForce" tooltip-persistent class="StatFormat" id = "Force"></div>
CSS :
[tooltip]:before {
/* needed - do not touch */
content: attr(tooltip);
position: absolute;
opacity: 0;
/* customizable */
transition: all 0.15s ease;
padding: 10px;
color: #333;
border-radius: 10px;
box-shadow: 2px 2px 1px silver;
}
[tooltip]:hover:before {
/* needed - do not touch */
opacity: 1;
/* customizable */
background: yellow;
margin-top: -50px;
margin-left: 20px;
}
[tooltip]:not([tooltip-persistent]):before {
pointer-events: none;
}
and the Javascript values :
var modifyForce = 0;
var forceBase = 15;
var Force = (forceBase + modifyForce);
document.getElementById("Force").innerHTML = Force;
document.getElementById("forceBase").innerHTML = forceBase;
document.getElementById("modifyForce").innerHTML = modifyForce;
My goal at the end is to display the value of "Force" then if you hoover this value with the mouse it display where this Force value comes from
for exemple:
Force : 20 (and if you hoover the "20" a tooltip appears and shows (15 + 5)
I found ways in jquery but I dont want to use jquery for specific reason.
Do you have any idea ? Thank you :)
mouseoverandmouseoutevents.