首页 > 代码库 > css3和js实现鼠标滑过图片微移动 平滑过渡

css3和js实现鼠标滑过图片微移动 平滑过渡

<!doctype html><html><head><meta charset="utf-8"><title>index</title>	<script src="http://www.mamicode.com/jquery-1.11.1.min.js"></script>	<body><div class="item">	<a href="">		<img src="http://www.mamicode.com/11.jpg">	</a></div><div class="item">	<a href="">		<img src="http://www.mamicode.com/11.jpg">	</a></div><style type="text/css">.item{  position:relative; width:295px; height:190px;  overflow:hidden; border:1px solid;  margin:10px;}.item a{ display:block;width:295px; height:190px;}.item a img{	-webkit-transition:all .3s ease;	-moz-transition:all .3s ease;	-ms-transition:all .3s ease;	-o-transition:all .3s ease;	transition:all .3s ease;	position:absolute;	left:0}.item a:hover img{ 	position:absolute; left:-10px;}</style><script>$(".item").bind("mouseenter", function(){	$(this).find("img").stop(!0).animate({"left": "-10px"});}).bind("mouseleave", function(){	$(this).find("img").stop(!0).animate({"left": "0px"});});</script></body></html>