zoukankan      html  css  js  c++  java
  • 用jQuery toggle函数控制div显示与隐藏

    canrun

    View Code
    <!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>
        <title>点击消失的DIV</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="Content-Language" content="zh-CN" />
        <script type="text/javascript" src="https://files.cnblogs.com/Zjmainstay/jquery-1.6.2.min.js"></script>
    </head>
    <body>
    <style>
    #adBlock{
        display:block;
        width:200px;
        height:300px;
        border:1px solid;
        float:left;
    }
    #clickController{
        border: 1px solid #AABBCC;
        display: block;
        float: left;
        height: 80px;
        padding: 1px;
        width: 16px;
    }
    </style>
    <div id="adBlock"></div>
    <div id="clickController"><< 点击我</div>
    <script type="text/javascript">
    $(document).ready(function(){
        $("#clickController").click(function(){        
            ($(this).text()=='>> 点击我')?$(this).text('<< 点击我'):$(this).text('>> 点击我');
            $("#adBlock").toggle(500);
        });
    });
    </script>
    </body>
    </html>
  • 相关阅读:
    爬去搜狐新闻体育类
    python中创建迭代器
    python中smtp协议的运用
    人如何修炼才能增强精神力
    修炼精神力量
    Java进阶图谱
    提高做一件事的成功概率
    详细说servlet
    深圳买车上牌流程
    excel 散点图预测
  • 原文地址:https://www.cnblogs.com/Zjmainstay/p/jQuery_toggle_div.html
Copyright © 2011-2022 走看看