給列表裡的 imge 設定滑鼠經過事件
阿新 • • 發佈:2018-12-20
<ul> <li><img src="1.jpg" onmouseover="changeColor(this)"></li> <li><img src="2.jpg" onmouseover="changeColor(this)"></li> </ul> <script> function changeColor(imgObj){ document.body.style.backgroundImage="url("+imgObj.src+")"; var img_show = null; $('td img').hover(function(){ var img = "<img class='img_msg' src='"+$(this).attr('src')+"' style='width:400px;' />"; img_show = layer.tips(img, this,{ tips:[2, 'rgba(41,41,41,.5)'] ,area: ['430px'] }); },function(){ layer.close(img_show); }); $('td img').attr('style','max-width:70px'); } </script>