和大家分享一个最近用到的jquery实现图片的放大缩小的特效。具体效果是鼠标移动到图片上,图片自动缩到左上角,右下角出现文字说明,鼠标移走后图片恢复,文字被图片遮挡。非常不错的一个图片特效功能。贴一下效果图:
jquery实现图片放大缩小特效的具体代码如下:
jquery实现图片放大缩小功能
.galleryContainer{width: 1024px;}
.galleryImage{background-color:black;width:325px;height:260px;overflow:hidden;margin:5px;float:left;}
.info{margin-left:10px;font-family:arial;padding:3px;}
.info h2{color:gray;}
.info p{color:white}
.clear{clear:both;margin-top:10px;}
$(document).ready(function(){
$('.galleryImage').hover(
function(){
$(this).find('img').animate({width:100, marginTop:10, marginLeft:10}, 500);
},
function(){
$(this).find('img').animate({width:325, marginTop:0, marginLeft:0},300);
});
});
Taylor Swift
Taylor Alison Swift (born December 13, 1989) is an American country pop singer-songwriter and actress.
Rihanna
Rihanna (born February 20, 1988) is a Barbadian R&B recording artist and model born in Saint Michael, Barbados.
Black Eyed Peas
The Black Eyed Peas is a Grammy Award winning hip hop group that formed in Los Angeles, California in 1995.