<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.my-title-content{
display: none;
width:150px;
position:absolute;
top:25px;
left:5px;
background:#F7F7F7;
border: 1px solid #666;
color:#666;
word-break: break-all;
word-wrap: break-word;
padding:5px;
}
[my-title]:hover + .my-title-content{
display: block;
}
</style>
</head>
<body>
<div style="position: relative;">
<input my-title type="text" />
<div class="my-title-content">111111111111111111111111111111111111</div>
</div>
<script type="text/x-javascript">
let resourceList = [
{
code:1,
name:"fish"
},
{
code:2,
name:"cat"
},
{
code:3,
name:"chiken"
},
];
var codeList = [1,2];
var resourceNameList = [];
resourceList.forEach(item => {
if(codeList.indexOf(item.code) > -1){
resourceNameList.push(item.name);
}
});
console.log(resourceNameList.toString());
</script>
</body>
</html>
css 实现title效果
