效果:
主要代码:
<script>
//获取元素
var box = document.querySelector('.box');
var title = box.children;
for (var i = 0; i < title.length; i++) {
title[i].onmouseover = function () {
this.children[1].style.display = 'block';
}
title[i].onmouseout = function () {
this.children[1].style.display = 'none';
}
}
</script>
全部代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content=&