вопрос - Почему hover срабатывает на границе браузера а не div а?
window.onmousemove = function()
{ var x = document.getElementById('xt') x.style.background = document.querySelectorAll('#x:hover').length ? 'red' : 'green'; } window.onload = function() { var xt = document.createElement('div'); xt.setAttribute('id','xt'); xt.setAttribute('style', ' width:300px; height:80px; background-color:gray; '); document.body.appendChild(xt); } |
Conus,
Потому что window.onmousemove относится ко всему окну браузера |
Часовой пояс GMT +3, время: 10:02. |