Код: Выделить всё
mouseoutКод: Выделить всё
My visible text
< /code>
export const attachTooltip = (node,options) => {
if (options) {
let _component
node.addEventListener('mouseover',addTooltip)
node.addEventListener('mouseout',removeTooltip)
function addTooltip(e) {
const {component, ...otherOpts} = options
_component = new component({
target: node,
props: {
mouseEvent: e,
...otherOpts
}
})
}
function removeTooltip(e) {
_component.$destroy()
}
return {
destroy() {
node.removeEventListener('mouseover',addTooltip)
node.removeEventListener('mouseout',removeTooltip)
}
}
}
}
{#if $$slots.Content}
{:else if innerHTML}
{@html innerHTML}
{/if}
@keyframes fadeInFromNone {
0% {
display: block;
opacity: 0;
}
1% {
display: block;
opacity: 0;
}
100% {
display: block;
opacity: 1;
}
}
.tip, .tip:before {
pointer-events: none;
box-sizing: border-box;
display: block;
opacity: 1;
}
.tip:before {
content: "";
position: absolute;
width: 2rem;
height: 2rem;
z-index: 13;
}
.tip {
animation: fadeInFromNone 0.05s linear 0.05s;
animation-fill-mode: both;
position: fixed;
color: black;
min-width: 3rem;
white-space: nowrap;
display: block;
text-overflow: ellipsis;
white-space: pre;
z-index: 12;
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... nteractive
Мобильная версия