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

jquery實(shí)現(xiàn)上下左右滑動(dòng)的方法

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

本文實(shí)例講述了jquery實(shí)現(xiàn)上下左右滑動(dòng)的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

復(fù)制代碼 代碼如下:
<!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>無(wú)標(biāo)題文檔</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>第一頁(yè)</p>
        <p>第一頁(yè)</p>
        <p>第一頁(yè)</p>
        <p>第一頁(yè)</p>
        <p>第一頁(yè)</p>
    </div>
    <div id="sec" style="text-align:center; width:200px; height:200px; display:none;position:absolute;">
        <p>第二頁(yè)</p>
        <p>第二頁(yè)</p>
        <p>第二頁(yè)</p>
        <p>第二頁(yè)</p>
        <p>第二頁(yè)</p>
    </div>
</div>
<div style="width:200px; height:50px;">
<input type="button" value="向右滾動(dòng)" id="btn"/>
    <input type="button" value="向左滾動(dòng)" id="btn2"/>
    <input type="button" value="向上滾動(dòng)" id="btn3"/>
    <input type="button" value="向下滾動(dòng)" id="btn4"/>
</div>
</body>
</html>

特別要注意:代碼中的position:absolute;一定要加上,否則不會(huì)出現(xiàn)效果。

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

沽源县| 辉南县| 多伦县| 仙居县| 常熟市| 长治县| 竹山县| 绥棱县| 八宿县| 德清县| 新乐市| 南城县| 交口县| 余姚市| 逊克县| 乾安县| 灌南县| 绍兴市| 苏尼特左旗| 黄骅市| 呼和浩特市| 尤溪县| 承德县| 镇安县| 灵宝市| 乌兰浩特市| 台山市| 新安县| 苗栗县| 毕节市| 平度市| 正镶白旗| 吉木乃县| 桃园县| 醴陵市| 乳源| 商河县| 武威市| 龙海市| 雅江县| 大同市|