日期:2014-05-16 浏览次数:20355 次
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
window.onload=(function(){
$("img:gt(4)").hide();
change();
$("button:first").click(function(){
$("img:visible:last").hide();
$("img:hidden:last").insertBefore($("img:visible:first"));
$("img:hidden:first").show();
change();
});
$("button:last").click(function(){
$("img:visible:first").hide();
$("img:hidden:first").insertAfter($("img:hidden:last"));
$("img:hidden:first").show();
change();
});
});
function change(){
$("img:visible:eq(0)").css("width","16%");
$("img:visible:eq(1)").css("width","21%");
$("img:visible:eq(2)").css("width","26%");
$("img:visible:eq(3)").css("width","21%");
$("img:visible:eq(4)").css("width","16%");
}
</script>
<style type="text/css">
div {position:absolute;background:#EEE;width:200px;}
span {width:84%;}
img {width:20%;}
button {width:8%;height:100%;}
</style>
</head>
<body>
<div><button><</button><span>
<img src="#" alt=1></img><img src="#" alt=2></img><img src="#" alt=3></img><img src="#" alt=4></img><img src="#" alt=5></img><img src="#" alt=6></img><img src="#" alt=7></img><img src="#" alt=8></img>
</span><button>></button></div>
</body>
</html>