Добрый день! Может быть, кто-нибудь решал следующую задачу: существует элемент, который двигается при нажатой на нем кнопке мыши. Нужно отследить, находится ли курсор одновременно и над другим "братским" элементом при перемещении?
var movdiv = document.getElementById('movob');
movdiv.onmousedown = function(curevent) {
moveAt(curevent);
function moveAt(curevent) {
movex = curevent.clientX;
movey = curevent.clientY;
movdiv.style.left = (movex - 75) + 'px';
movdiv.style.top = (movey - 75) + 'px';
}
document.onmousemove = function(curevent) {
moveAt(curevent);
}
movdiv.onmouseup = function(curevent) {
document.onmousemove = null;
}
}
var clidiv = document.getElementById('cliob');
clidiv.onmouseover = function(event2) {
console.log('over!');
}
<div id="back" style="position: absolute; background-color: yellow; width: 1000px; height: 600px; left: 50px; right: 50px;">
<div id="cliob" style="position: absolute; background-color: grey; width: 100px; height: 100px; left: 250px; top: 250px;"></div>
<div id="movob" style="position: absolute; background-color: blue; width: 100px; height: 100px; left: 50px; top: 50px; z-index: 50;"></div>
</div>
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости