<!DOCTYPE html><html><head><meta charset="UTF-8"><title>兼容所有的触摸事件</title><style type="text/css">ul{width:255px;margin:100px auto;list-style: none;position: relative;}li{width:60px;display: inline-block; *display:inline-block;*zoom:1}img{width:50px;height:50px;}#show{display: none; position: absolute;}</style></head><body> <ul> <li> <img src="img/1.jpg" alt=""> </li> <li> <img src="img/2.jpg" alt=""> </li> <li> <img src="img/3.jpg" alt=""> </li> <img src="img/4.jpg" alt="" id="show"> </ul> <script type="text/javascript"> img=document.getElementsByTagName("img"); img1=document.getElementById("show"); for(var i=0;i<img.length;i++){ img[i].onmouseover=function(){ img1.style.display="block"; img1.style.left="30px"; img1.style.top="60px"; } img[i].onmouseout=function(){ img1.style.display="none"; } } </script></body></html>
添加回答
举报
0/150
提交
取消