最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jquery實現上下左右滑動的方法

 更新時間:2015年02月09日 15:08:18   作者:hukang00  
這篇文章主要介紹了jquery實現上下左右滑動的方法,是jQuery特效中非常典型的應用,需要的朋友可以參考下

本文實例講述了jquery實現上下左右滑動的方法。分享給大家供大家參考。具體實現方法如下:

復制代碼 代碼如下:
<!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>

特別要注意:代碼中的position:absolute;一定要加上,否則不會出現效果。

希望本文所述對大家的jQuery程序設計有所幫助。

相關文章

最新評論

惠东县| 疏附县| 永仁县| 永康市| 云阳县| 彭山县| 金乡县| 凤台县| 双城市| 霸州市| 哈巴河县| 涿鹿县| 高台县| 香格里拉县| 丹江口市| 泰顺县| 墨脱县| 翁牛特旗| 萨嘎县| 张家港市| 临泉县| 泸西县| 稷山县| 桐庐县| 瑞安市| 庆安县| 任丘市| 玛曲县| 耿马| 沙田区| 华宁县| 晴隆县| 独山县| 沈阳市| 鹤庆县| 永春县| 比如县| 漠河县| 长子县| 墨玉县| 丰台区|