鼠标悬停放大图片效果

设置鼠标移入移出事件onmouseover="over(this,this.src)" onmouseout="out(this)"
<div id="divbigimage" style="display:none;width:300px;height:300px;position:absolute;">
		<img src="" id="big" style="width:300px; height:300px"/>
</div>
  

ps:div的位置要放对,一般多个页面组合的,要放在主页面上

function over(obj_small,obj_big){
	var divx = window.event.clientX;
	var divy = window.event.clientY;
	var divmove = document.getElementById("divbigimage");
	divmove.style.left = divx+'px';
	divmove.style.top = divy+'px';
	obj_small.style.border="solid 1px blue";
	document.getElementById("big").src=obj_big;
	document.getElementById("divbigimage").style.display="block";
}
	
function out(obj_small){
	obj_small.style.border=0;
	document.getElementById("divbigimage").style.display="none";
}

  

posted @ 2016-04-14 14:17  没错就是那个小新  阅读(654)  评论(0编辑  收藏  举报