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>

  • 相关阅读:
    Maven3核心技术(笔记三)
    解决Ubuntu下Sublime Text 3无法输入中文
    python3项目之数据可视化
    Python模块Pygame安装
    PHP命名空间(Namespace)
    git的安装使用和代码自动部署
    input:text 的value 和 attribute('value') 不是一回事
    touch事件学习
    获得 选中文字
    linux使用crontab实现PHP执行定时任务及codeiginter参数传递相关
  • 原文地址:https://www.cnblogs.com/vania/p/3323726.html
Copyright © 2011-2022 走看看