以下是 jQuery鼠标滑过图片滑动特效js代码 的示例演示效果:
部分效果截图:
HTML代码(index.html):
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery鼠标滑过图片滑动特效</title>
<style type="text/css">
*{ margin:0px; padding:0px;}
.wamp{ width:1000px; margin:50px auto; display:block; background:#fff; height:200px; position:relative; overflow:hidden;}
.box_w{ width:1000px;white-space:nowrap; font-size:0px; position:absolute; left:0px; top:0px;}
.box_w dl{ width:250px;white-space:nowrap;font-size:0px; overflow:hidden; display:inline-block; cursor:pointer;}
.box_w dt{ width:250px; height:105px;display:inline-block; }
.box_w dd{ width:744px; height:95px;display:inline-block; margin-top:10px;}
.box_w dd img{ width:100%; height:95px; display:inline-block;}
.box_w a{ display:inline-block;}
</style>
</head>
<body>
<div class="wamp">
<div class="box_w">
<dl>
<dt><a><img src="img/1.jpg"/></a></dt>
<dd><a><img src="img/6.jpg"/></a></dd>
</dl>
<dl>
<dt><a><img src="img/2.jpg"/></a></dt>
<dd><a><img src="img/7.jpg"/></a></dd>
</dl>
<dl>
<dt><a><img src="img/3.jpg"/></a></dt>
<dd><a><img src="img/9.jpg"/></a></dd>
</dl>
<dl>
<dt><a><img src="img/4.jpg"/></a></dt>
<dd><a><img src="img/8.jpg"/></a></dd>
</dl>
</div>
</div>
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$('.box_w dl').mouseover(function(){
var aa=$(this).index();
var aac=-aa*250
$(this).parent('.box_w').stop().animate({left:aac},600)
$(this).stop().animate({width:"1000px"},600).siblings('dl').stop().animate({width:"250px"},600);
})
$('.box_w dl').mouseout(function(){
$(this).parent('.box_w').stop().animate({left:"0px"},600)
$(this).stop().animate({width:"250px"},600)
})
})
</script>
</body>
</html>