以下是 jQuery鼠标悬停遮罩阴影效果js代码 的示例演示效果:
部分效果截图:
HTML代码(index.html):
<!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=utf-8" />
<title>jQuery鼠标悬停遮罩阴影效果</title>
<style>
*{ margin:0; padding:0; list-style:none;}
img{ border:0;}
.zzsc{ width:1020px; height:auto; margin:100px auto; overflow:hidden; padding-bottom:50px;font-family:'Microsoft Yahei';}
.zzsc ul li{ width:230px; height:300px; overflow:hidden; float:left; margin:0px 12px; position:relative; text-align:center;}
.zzsc ul li img{ width:230px; height:300px; position:absolute; left:0; top:0; z-index:10; background:url(http://www.zzsc.com/demo/images/loading.gif) no-repeat center center;}
.zzsc ul li .mark{ background:url(images/jia.png) no-repeat center 80px #000;opacity:0.7; display:none; width:230px; height:300px; position:absolute; left:0; top:0; z-index:15; text-indent:-3000px; overflow:hidden;filter:alpha(opacity=0.7);}
.zzsc ul li .mark2{ width:230px; height:100px; line-height:100px;background:url(images/touming.png) no-repeat center top; position:absolute; left:0; top:200px; color:#fff; font-size:18px; z-index:20;}
</style>
</head>
<body>
<div class="zzsc">
<ul>
<li>
<img src='images/zzsc.jpg'>
<a href="#" class="mark">qq在线客服代码</a>
<div class="mark2">qq在线客服代码</div>
</li>
<li>
<img src='images/zzsc.jpg'>
<a href="#" class="mark">菜单导航</a>
<div class="mark2">菜单导航</div>
</li>
<li>
<img src='images/zzsc.jpg'>
<a href="#" class="mark">焦点图banner</a>
<div class="mark2">焦点图banner</div>
</li>
<li>
<img src='images/zzsc.jpg'>
<a href="#" class="mark">图片特效</a>
<div class="mark2">图片特效</div>
</li>
</ul>
</div>
<script src="js/jquery.min.js"></script>
<script>
$(function(){
$('.zzsc ul li').hover(function(){
$('.mark',this).fadeIn();
},function(){
$('.mark',this).fadeOut();
});
});
</script>
</body>
</html>