fix: улучшить делегирование mouseover на весь блок .uptime-segs для стабильных тултипов
Build and deploy / build-deploy (push) Has been cancelled
Build and deploy / build-deploy (push) Has been cancelled
This commit is contained in:
@@ -379,11 +379,14 @@ function escapeHtml(s) {
|
|||||||
|
|
||||||
// Делегирование: тултип на весь контейнер сегментов.
|
// Делегирование: тултип на весь контейнер сегментов.
|
||||||
document.addEventListener('mouseover', e => {
|
document.addEventListener('mouseover', e => {
|
||||||
const seg = e.target.closest('.uptime-seg[data-seg]');
|
const seg = e.target.closest('.uptime-seg[data-seg]') || e.target.closest('.uptime-segs');
|
||||||
if (seg) showSegTip(seg);
|
if (seg) {
|
||||||
|
const targetSeg = seg.classList.contains('uptime-seg') ? seg : seg.querySelector('.uptime-seg[data-seg]');
|
||||||
|
if (targetSeg) showSegTip(targetSeg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
document.addEventListener('mouseout', e => {
|
document.addEventListener('mouseout', e => {
|
||||||
if (e.target.closest('.uptime-seg[data-seg]')) hideSegTip();
|
if (e.target.closest('.uptime-seg[data-seg]') || e.target.closest('.uptime-segs')) hideSegTip();
|
||||||
});
|
});
|
||||||
document.addEventListener('scroll', hideSegTip, true);
|
document.addEventListener('scroll', hideSegTip, true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user