Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Html中的折叠字段_Javascript_Html_Collapse - Fatal编程技术网

Javascript Html中的折叠字段

Javascript Html中的折叠字段,javascript,html,collapse,Javascript,Html,Collapse,如果选中复选框,如何在Html中创建可能会折叠的字段。 我在Django编程 问候,, Gintare您需要一个javascript库,比如jQuery,这样就很容易将动画动作分配给事件。阅读jQuery文档来学习,或者剪切并粘贴其他人很快就会放在这里的解决方案 请注意,这不是Django特有的问题,而是它的javascript和html。您需要一个javascript库,比如jQuery,这样可以很容易地将动画动作分配给事件。阅读jQuery文档来学习,或者剪切并粘贴其他人很快就会放在这里的解

如果选中复选框,如何在Html中创建可能会折叠的字段。 我在Django编程

问候,,
Gintare

您需要一个javascript库,比如jQuery,这样就很容易将动画动作分配给事件。阅读jQuery文档来学习,或者剪切并粘贴其他人很快就会放在这里的解决方案


请注意,这不是Django特有的问题,而是它的javascript和html。

您需要一个javascript库,比如jQuery,这样可以很容易地将动画动作分配给事件。阅读jQuery文档来学习,或者剪切并粘贴其他人很快就会放在这里的解决方案


注意,这不是Django特有的问题,它的javascript和html。

下面的jQuery代码使用“+”的图像,然后是标题。e、 g.+前十名

我用它来制作手风琴

$(document).ready(function () {
    $("div#hideable div").hide();
    // add css to show +/- symbols and labels - no point showing them if they don't work!
    $("div#hideable h3 a img").css("display", "inline");
    $("div#hideable label").css("display", "inline");

    $("div#hideable h3 a").toggle(function () {
        $($(this).attr("href")).show();
        imgName = $(this).find('img').attr("src").split("-", 1); //grab the image name so that we get the right one
        $(this).find('img').attr("src", imgName + "-minus.gif"); //change img, alt and label to match action
        $(this).find('img').attr("alt", "-");
        var sectionId = $(this).attr("href").substring($(this).attr("href").length - 1);
        if (sectionId == 0) {
            sectionId = 10;
        }
        labelName = "#lblSection" + sectionId;
        $(labelName).text("click '-' to collapse");
    }, function () {
        $($(this).attr("href")).hide();
        $(this).find('img').attr("src", imgName + "-plus.gif");
        $(this).find('img').attr("alt", "+");
        var sectionId = $(this).attr("href").substring($(this).attr("href").length - 1);
        if (sectionId == 0) {
            sectionId = 10;
        }
        labelName = "#lblSection" + sectionId;
        $(labelName).text("click '+' to expand");
    });
});

下面的jQuery代码使用“+”的图像,然后是标题。e、 g.+前十名

我用它来制作手风琴

$(document).ready(function () {
    $("div#hideable div").hide();
    // add css to show +/- symbols and labels - no point showing them if they don't work!
    $("div#hideable h3 a img").css("display", "inline");
    $("div#hideable label").css("display", "inline");

    $("div#hideable h3 a").toggle(function () {
        $($(this).attr("href")).show();
        imgName = $(this).find('img').attr("src").split("-", 1); //grab the image name so that we get the right one
        $(this).find('img').attr("src", imgName + "-minus.gif"); //change img, alt and label to match action
        $(this).find('img').attr("alt", "-");
        var sectionId = $(this).attr("href").substring($(this).attr("href").length - 1);
        if (sectionId == 0) {
            sectionId = 10;
        }
        labelName = "#lblSection" + sectionId;
        $(labelName).text("click '-' to collapse");
    }, function () {
        $($(this).attr("href")).hide();
        $(this).find('img').attr("src", imgName + "-plus.gif");
        $(this).find('img').attr("alt", "+");
        var sectionId = $(this).attr("href").substring($(this).attr("href").length - 1);
        if (sectionId == 0) {
            sectionId = 10;
        }
        labelName = "#lblSection" + sectionId;
        $(labelName).text("click '+' to expand");
    });
});
触摸太空人

我还推荐jquery(),因为它非常易于使用

这里有一些代码在心跳中被激发出来

$("#my_checkbox").change( function() { 
   if ($(this).is(':checked')) {
      $("#my_html").hide(); // hide element with id="my_html"
   } else {
      $("#my_html").show(); // show...
   }
});
触摸太空人

我还推荐jquery(),因为它非常易于使用

这里有一些代码在心跳中被激发出来

$("#my_checkbox").change( function() { 
   if ($(this).is(':checked')) {
      $("#my_html").hide(); // hide element with id="my_html"
   } else {
      $("#my_html").show(); // show...
   }
});