返回jQuery ......登陆

jQuery 上下左右滑动

阿神2016-11-08 10:55:11382

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<script type="text/javascript" src="jquery-1.11.2.js"></script>

<script type="text/javascript">

$(document).ready(function(){

$("#btn").unbind().click(function(){

$("#first").hide();

$("#sec").css("left","-200px").animate({"left":"0px"},500).show();

});

  

$("#btn2").unbind().click(function(){

$("#sec").hide();

$("#first").css("left","200px").animate({"left":"0px"},500).show();

});

  

$("#btn3").unbind().click(function(){

$("#first").hide();

$("#sec").css("top","200px").animate({"top":"0px"},500).show();

});

  

$("#btn4").unbind().click(function(){

$("#sec").hide();

$("#first").css("top","-200px").animate({"top":"0px"},500).show();

});

});

</script>

</head>

  

  

<body>

<div style="width:200px; height:200px;">

<div id="first" style="text-align:center; width:200px; height:200px;position:absolute;">

    <p>第一页</p>

        <p>第一页</p>

        <p>第一页</p>

        <p>第一页</p>

        <p>第一页</p>

    </div>

    <div id="sec" style="text-align:center; width:200px; height:200px; display:none;position:absolute;">

        <p>第二页</p>

        <p>第二页</p>

        <p>第二页</p>

        <p>第二页</p>

        <p>第二页</p>

    </div>

</div>

<div style="width:200px; height:50px;">

<input type="button" value="向右滚动" id="btn"/>

    <input type="button" value="向左滚动" id="btn2"/>

    <input type="button" value="向上滚动" id="btn3"/>

    <input type="button" value="向下滚动" id="btn4"/>

</div>

</body>

</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送