【www.gdgbn.com--jquery】

现在利用jquery实现滑动菜单是非常简单的一件事情,下面我们来一款滑动菜单利用jquery实现的代码吧。



here
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>



1
2
3
4
5
6
7
8
9
10





1
2
3
4
5
6
7
8
9
10




<script>
$(document).ready(function(){
var speed = 1000;
var div_width = $("#list > div:first").width() + parseint($("#list > div:first").css教程("margin-left")) + parseint($("#list > div:first").css("margin-right"));
var offset = 220;
$(".button").click(function(){
id = $(this).attr("id").replace("button","");
var _length = -(id - 1) * div_width - offset;
$("#list").animate({left:_length + "px"},speed);
});
});
</script>

本文来源:http://www.gdgbn.com/wangyezhizuo/28076/