zoukankan      html  css  js  c++  java
  • [ jquery 效果 slideToggle([speed,[easing],[fn]]) ] 此方法用于滑动显示隐藏的被选元素

    通过高度变化来切换所有匹配元素的可见性,并在切换完成后可选地触发一个回调函数;

    这个动画效果只调整元素的高度,可以使匹配的元素以“滑动”的方式隐藏或显示。在jQuery 1.3中,上下的padding和margin也会有动画,效果更流畅

    实例:

    <html lang='zh-cn'>
    <head>
    <title>Insert you title</title>
    <meta http-equiv='description' content='this is my page'>
    <meta http-equiv='keywords' content='keyword1,keyword2,keyword3'>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type='text/javascript' src='./js/jquery-1.12.1.min.js'></script>
    <style type="text/css">
        *{margin:0;padding:0;}
        html{font:400 15px/1.2em 'Courier New';color:#666;750px;margin:25px auto;}
        #show{250px;height:400px;background:red;display:none;color:#FFF;line-height:400px;text-indent:8px;padding:10px 30px;margin:70px;text-align:center;}
        button{padding:8px;border:0;outline:none;background:#00E92C;border-radius:2px;}
        .wrapAll{color:#FF96EC;}
    </style>
    <script type='text/javascript'>
        $(function(){
            $('button').click(function(){
                $('#show').slideToggle(1000,'linear',function(){
                    var num = 0;
                    console.log(num++);
                });
            });
        });
    </script>
    </head>
    <body>
        <div id='demo'>
            <button type="button">button</button>
            <div id='show'>Test text</div>
        </div>
    </body>
    </html>
  • 相关阅读:
    恢复更新
    Sun与Google结为战略合作伙伴, 可能联合Sun推出Web Office
    Outlook数据文件备份和按年存档的办法
    新装的几个软件试用体会(WPS 2005,Opera,QQ 2005 Beta3)
    关于VBA和Excel,GIS软件
    人格测试
    Taking a serious look at grids
    iPod、iMac 5、iTunes 6
    如此“自助”
    UCGIS优先研究领域介绍
  • 原文地址:https://www.cnblogs.com/mysearchblog/p/5619208.html
Copyright © 2011-2022 走看看