<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="../js/jquery-3.3.1.min.js"></script>
<style>
#t {
/* for illustrative purposes */
width: 200px;
height: 200px;
border: red solid 1px;
}
#t:hover {
overflow: hidden;
}
</style>
</head>
<body>
<div id="t">dcscsds</div>
<script>
setTimeout(function() {
var c = window.getComputedStyle(document.getElementById('t')).getPropertyValue('overflow');
if (c === 'hidden') {
alert('Mouse in box');
} else {
alert('Mouse not in box');
}
}, 3000);
</script>
</body>
</html>
js_判断鼠标是否在div上
最新推荐文章于 2023-11-14 21:19:11 发布