html5中文学习网

您的位置: 首页 > 网站及特效实例 > javascript特效 » 正文

一个跟随鼠标的图片放大效果,与FF兼容_图象特效_

[ ] 已经帮助:人解决问题

<div align=center style="overfow: hidden; width: 100px; height: 100px"><img src="http://files.jb51.net/upload/2007426163751315.jpg" width="100" height="100" border="0" onmouseover="show(this)" onmouseout="hide(this)">
</div>
<div align=center style="overfow: hidden; width: 100px; height: 100px">
<img src="http://files.jb51.net/upload/200742616381460.jpg" width="100" height="100" border="0" onmouseover="show(this)" onmouseout="hide(this)">
</div>
<div align=center style="overfow: hidden; width: 100px; height: 100px">
<img src="http://files.jb51.net/upload/200742616383849.jpg" width="100" height="100" border="0" onmouseover="show(this)" onmouseout="hide(this)">
</div>
<div id="enlarge_images" style="position: absolute; z-index:2"></div>

<SCRIPT>        
function show(_this) {
    document.getElementById("enlarge_images").innerHTML = "<img src='" + _this.src + "' >";
}
function hide(_this) {
    document.getElementById("enlarge_images").innerHTML = "";
}
function move_layer(event){
    event = event || window.event;
    enlarge_images.style.left=event.clientX+document.body.scrollLeft+10;
    enlarge_images.style.top=event.clientY+document.body.scrollTop+10;
}
document.onmousemove =move_layer;
</SCRIPT>


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助