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

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>index</title>
	<script src="jquery-1.11.1.min.js"></script>
	

<body>

<div class="item">
	<a href="">
		<img src="11.jpg">
	</a>
</div>


<div class="item">
	<a href="">
		<img src="11.jpg">
	</a>
</div>

<style type="text/css">
.item{  position:relative; 295px; height:190px;  overflow:hidden; border:1px solid;  margin:10px;}
.item a{ display:block;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>

  

原文地址:https://www.cnblogs.com/1haojia/p/3785399.html