您的位置:首页 > 其它

图片鼠标透明效果

2013-12-04 09:52 120 查看
实现的思想:

1、当鼠标放在图片上面的时候触发mouseover  mouseenter两个事件(图片变得透明)
2、当鼠标离开图片的时候触发mouseleave mouseout两个事件(图片变为不透明)

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script src="lib/jquery-1.6.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(
function(){
$("#img_id").bind("mouseover  mouseenter",function(){
$(this).fadeTo("slow", 0.66);
});
$("#img_id").bind("mouseleave mouseout",function(){
$(this).fadeTo("fast", 1);
});
}
);

</script>
<title>无标题文档</title>
</head>
<img src="img/GB-wp1.jpg" id="img_id" height="200" width="200"/>
<body>
</body>
</html>

 

测试代码.zip (381.5 KB)

下载次数: 0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: