zoukankan      html  css  js  c++  java
  • Jquery | 基础 | 事件的链式写法

    $(".title").click(function () {
      $(this).addClass("curcol").next(".content").css("display", "block");
    });

    <!DOCTYPE html>
    <html>
    
    <head>
        <title>jQuery事件的链式写法</title>
        <script src="jquery-3.3.1.min.js" type="text/javascript"></script>
        <style type="text/css">
            .iframe {
                border: solid 1px #888;
                font-size: 13px;
            }
    
            .title {
                padding: 6px;
                background-color: #EEE;
            }
    
            .content {
                padding: 8px 0px;
                font-size: 12px;
                text-align: center;
                display: none;
            }
    
            .curcol {
                background-color: #CCC
            }
        </style>
        <script type="text/javascript">
            $(function () {
                $(".content").html("您好!欢迎来到jQuery的精彩世界。");
                $(".title").click(function () {
                    $(this).addClass("curcol").next(".content").css("display", "block");
                });
            });
        </script>
    </head>
    
    <body>
        <div class="iframe">
            <div class="title">标题</div>
            <div class="content"></div>
        </div>
    </body>
    
    </html>

    当页面首次加载时,被包含的内容<div> 标记是不可见的,当用户单击主题<div> 标记时,改变自身的背景色,并将内容<div> 标记显示出来。

  • 相关阅读:
    编码器-解码器模型--本人实现
    Encoder-Decoder 架构实现
    一些数据集
    论文跟踪
    Densenet 实现
    多种卷积网络实现
    vs2019 指定项目输出目录和指定中间目录
    poi java读取excel文件
    eclipse配置tomcat添加外部项目
    eclipse配置tomcat
  • 原文地址:https://www.cnblogs.com/jj81/p/9801000.html
Copyright © 2011-2022 走看看