Home >Web Front-end >JS Tutorial >Sliding sample code based on jquery_jquery

Sliding sample code based on jquery_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 18:15:441225browse
复制代码 代码如下:



here




1

2

3

4

5

6

7

8

9

10






1

2

3

4

5

6

7

8

9

10





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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn