zoukankan      html  css  js  c++  java
  • 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=gb2312" />
    <title>展开关闭效果</title>
    <script type="text/javascript" src="jquery.min.js"></script>
    <style>
    bady{font-family:"微软雅黑", "黑体";font-size:12px;}
    .nav{ width:400px; overflow:hidden; margin-bottom:8px;}
    .nav_tit{background:#000000;height:27px;line-height:27px; width:400px;color:#ffffff;text-align:center; overflow:hidden}
    .key{width:50px;float:right;margin:0 0 0 0; cursor:pointer;}
    .nav_box{ width:400px; height:200px; background-color:#0066CC;}
    </style>
    </head>
    
    <body>
    
    <div class="nav">
    <div class="nav_tit"><span class="key">展开</span><span>标题</span></div>
    <div class="nav_box">sdfsf</div>
    </div>
    
    <div class="nav">
    <div class="nav_tit"><span class="key">展开</span><span>标题</span></div>
    <div class="nav_box">sdfsf</div>
    </div>
    
    
    </body>
    </html>
    <script type="text/javascript">
    $(function(){
    $(".nav_box").hide();
    $(".key").toggle(function(){
    $(this).html("关闭");
    $(this).parent().parent().find(".nav_box").toggle();
    },function(){
    $(this).html("展开");
    $(this).parent().parent().find(".nav_box").toggle();
    });
    });
    </script>

    <!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=gb2312" />
    <title>展开关闭效果</title>
    <script type="text/javascript" src="jquery.min.js"></script>
    <style>
    bady{font-family:"微软雅黑", "黑体";font-size:12px;}
    .nav{ 400px; overflow:hidden; margin-bottom:8px;}
    .nav_tit{background:#000000;height:27px;line-height:27px; 400px;color:#ffffff;text-align:center; overflow:hidden}
    .key{50px;float:right;margin:0 0 0 0; cursor:pointer;}
    .nav_box{ 400px; height:200px; background-color:#0066CC;}
    </style>
    </head>

    <body>

    <div class="nav">
    <div class="nav_tit"><span class="key">展开</span><span>标题</span></div>
    <div class="nav_box">sdfsf</div>
    </div>

    <div class="nav">
    <div class="nav_tit"><span class="key">展开</span><span>标题</span></div>
    <div class="nav_box">sdfsf</div>
    </div>


    </body>
    </html>
    <script type="text/javascript">
    $(function(){
    $(".nav_box").hide();
    $(".key").toggle(function(){
    $(this).html("关闭");
    $(this).parent().parent().find(".nav_box").toggle();
    },function(){
    $(this).html("展开");
    $(this).parent().parent().find(".nav_box").toggle();
    });
    });
    </script>

  • 相关阅读:
    20150216 IMX257实现GPIO-查询按键驱动程序
    20150216简单的Linux字符设备驱动程序
    Linux内核驱动编程
    解决安装完centos6.6之后/etc/sysconfig/目录下没有iptables 的问题
    centos6.6安装配置jboss7.1.1
    mysql5.6中 order by 多个字段排序问题
    centos6.6编译安装lnmp系列之PHP
    centos6.6编译安装lnmp系列之nginx
    centos6.6编译安装lnmp系列之mysql
    mysq 安装时候进行生成数据库系统时候执行语句 ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql 时候报错
  • 原文地址:https://www.cnblogs.com/vania/p/3323726.html
Copyright © 2011-2022 走看看