JS 实现鼠标指向图片时图片放大的效果

图片定义

<img id="img" onmouseover="bigger()" onmouseout="smaller()" src="你的图片路径" style="cursor:pointer;width:100px;height:100px;" />

js

<script type="text/javascript">
 var img = document.getElementById('img');

 function bigger(){
  img.style.width = '400px';
  img.style.height = '400px';
 }

 function smaller(){
  img.style.width = '100px';
  img.style.height = '100px';
 }
</script>

转自:https://blog.csdn.net/myadminwu/article/details/74529675

猜你喜欢

转载自blog.csdn.net/qidasheng2012/article/details/84873241