Posted on 2011-04-21 23:34
哈希 阅读(100)
评论(0) 编辑 收藏 所属分类:
Js and Jquery 常用总结
<!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>
<title>jQuery插件实现感应鼠标的图片遮罩动画效果丨芯晴网页特效丨CsrCode.Cn</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<!--把下面代码加到<head>与</head>之间-->
<style type="text/css">
html, body, div,ul, li {
margin: 0;
padding: 0;
}
div.examples_body {
width: 750px;
margin: 0px auto;
clear: both;
overflow: hidden;
}
/* The main banner unordered list */
.bannerHolder {
width: 726px;
margin: 20px 0 15px 0;
padding: 20px 10px 20px 10px;
background-color: #f7f7f7;
border: 1px solid #eee;
overflow: hidden;
/* CSS3 rounded corners */
-moz-border-radius:12px;
-webkit-border-radius:12px;
border-radius:12px;
}
/* Hiding the bullets of the li elements: */
.bannerHolder li {
list-style: none;
display: inline;
}
/* The banner divs */
.banner {
position: relative;
width: 125px;
height: 125px;
overflow: hidden;
float: left;
display: inline;
margin: 0 10px
}
/* The banner divs */
.banner img {
display: block;
border: none;
}
/* The dark animated divs */
.banner div {
position: absolute;
z-index: 100;
background-color: #222;
width: 60px;
height: 60px;
cursor: pointer;
/* Setting a really big value for border-radius
will make the divs perfect circles */
-moz-border-radius:100px;
-webkit-border-radius:100px;
border-radius:100px;
}
/* Positioning the animated divs outside the
corners of the visible banner area: */
.banner .cornerTL {
left:-63px;
top:-63px;
}
.banner .cornerTR {
right:-63px;
top:-63px;
}
.banner .cornerBL {
left:-63px;
bottom:-63px;
}
.banner .cornerBR {
right:-63px;
bottom:-63px;
}
/* The "Visit Company" text */
.banner p {
display: none; /* hidden by default */
left: 0;
top: 57px;
width: 100%;
z-index: 200;
position: absolute;
font-family: Tahoma, Arial, Helvetica, sans-serif;
color: #FFF;
font-size: 11px;
text-align: center;
cursor: pointer;
}
</style>
<script type="text/javascript" src="http://www.blogjava.net/images/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// Lowering the opacity of all slide in divs
$('.banner div').css('opacity',0.4);
// Using the hover method
$('.banner').hover(function(){
// Executed on mouseenter
var el = $(this);
// Find all the divs inside the banner div,
// and animate them with the new size
el.find('div').stop().animate({width:200,height:200},'slow',function(){
// Show the "Visit Company" text:
el.find('p').fadeIn('fast');
});
},function(){
// Executed on moseleave
var el = $(this);
// Hiding the text
el.find('p').stop(true,true).hide();
// Animating the divs
el.find('div').stop().animate({width:60,height:60},'fast');
}).click(function(){
// When clicked, open a tab with the address of the hyperlink
window.open($(this).find('a').attr('href'));
});
});
</script>
</head>
<body>
预览效果时左下角会提示错误,而且看不到效果,刷新一下就可以看到效果了;当然,在实际使用中,不会出现这样的问题。<br>
<!--把下面代码加到<body>与</body>之间-->
<div class="examples_body">
<ul class="bannerHolder">
<li>
<div class="banner">
<a href="http://www.csrcode.cn" target="_blank"><img height="125" width="125" alt="红叶传情" src="http://www.blogjava.net/images/m01.jpg"></a>
<p class="companyInfo">红叶传情</p>
<div class="cornerTL"></div>
<div class="cornerTR"></div>
<div class="cornerBL"></div>
<div class="cornerBR"></div>
</div>
</li>
<li>
<div class="banner">
<a href="http://www.33567.cn" target="_blank"><img height="125" width="125" alt="野花绽放" src="http://www.blogjava.net/images/m02.jpg"></a>
<p class="companyInfo">野花绽放</p>
<div class="cornerTL"></div>
<div class="cornerTR"></div>
<div class="cornerBL"></div>
<div class="cornerBR"></div>
</div>
</li>
<li>
<div class="banner">
<a href="http://www.7caidy.com" target="_blank"><img height="125" width="125" alt="往事如茶" src="http://www.blogjava.net/images/m03.jpg"></a>
<p class="companyInfo">往事如茶</p>
<div class="cornerTL"></div>
<div class="cornerTR"></div>
<div class="cornerBL"></div>
<div class="cornerBR"></div>
</div>
</li>
<li>
<div class="banner">
<a href="http://ww.33567.cn" target="_blank"><img height="125" width="125" alt="油菜花开" src="http://www.blogjava.net/images/m04.jpg"></a>
<p class="companyInfo">油菜花开</p>
<div class="cornerTL"></div>
<div class="cornerTR"></div>
<div class="cornerBL"></div>
<div class="cornerBR"></div>
</div>
</li>
<li>
<div class="banner">
<a href="http://changshi.csrcode.cn" target="_blank"><img height="125" width="125" alt="玫瑰情思" src="http://www.blogjava.net/images/m05.jpg"></a>
<p class="companyInfo">玫瑰情思</p>
<div class="cornerTL"></div>
<div class="cornerTR"></div>
<div class="cornerBL"></div>
<div class="cornerBR"></div>
</div>
</li>
</ul>
</div>
</body>
</html>
<br><br><hr><p align="center"><font color=black>本特效由 <a href="http://www.CsrCode.cn" target="_blank">芯晴网页特效</a>丨CsrCode.Cn 收集于互联网,只为兴趣与学习交流,不作商业用途。来源:中国站长天空</font></p>