显示:none;

时间:2017-09-19 16:32:02

标签: javascript html css

图片1

enter image description here

图2

enter image description here



<form class="row" method="post">
   <input type="hidden" name="csrfmiddlewaretoken" value="kAM5G4Fg3VtTOHfSrzlB2ScLrkgHhBycDvA3FQcAebnlPjvoBcIX9Txyz4NQpFaJ">
   <div class="card-content">
      <div class="row">
         <div class="col s3">
            <div id="div_id_type_choice" class="input-field ">
               <div class="select-wrapper select initialized">
                  <span class="caret">▼</span><input type="text" class="select-dropdown" readonly="true" data-activates="select-options-16fc2fd1-3a01-3d50-5f53-bf229cc2b819" value="Total number of clients">
                  <ul id="select-options-16fc2fd1-3a01-3d50-5f53-bf229cc2b819" class="dropdown-content select-dropdown" style="width: 158px; position: absolute; top: 1px; left: 0px; opacity: 1; display: none;">
                     <li class=""><span>Total number of clients</span></li>
                     <li class="active selected"><span>Total new loans</span></li>
                     <li class=""><span>Total renewals</span></li>
                     <li class=""><span>Total debit fees</span></li>
                     <li class=""><span>Total brokerage fees</span></li>
                     <li class=""><span>Total interest</span></li>
                     <li class=""><span>Total accounts receivable</span></li>
                     <li class=""><span>Total active accounts receivable</span></li>
                     <li class=""><span>Total special accounts receivable</span></li>
                     <li class=""><span>Total accounts loss</span></li>
                     <li class=""><span>Total completed loans</span></li>
                     <li class=""><span>Total terminated loans</span></li>
                     <li class=""><span>Total suspended loans</span></li>
                     <li class=""><span>Total delayed fees</span></li>
                     <li class=""><span>Total denied fees</span></li>
                  </ul>
                  <select class="select initialized" id="id_type_choice" name="type_choice">
                     <option value="0" selected="selected">Total number of clients</option>
                     <option value="1">Total new loans</option>
                     <option value="2">Total renewals</option>
                     <option value="3">Total debit fees</option>
                     <option value="4">Total brokerage fees</option>
                     <option value="5">Total interest</option>
                     <option value="6">Total accounts receivable</option>
                     <option value="7">Total active accounts receivable</option>
                     <option value="8">Total special accounts receivable</option>
                     <option value="9">Total accounts loss</option>
                     <option value="10">Total completed loans</option>
                     <option value="11">Total terminated loans</option>
                     <option value="12">Total suspended loans</option>
                     <option value="13">Total delayed fees</option>
                     <option value="14">Total denied fees</option>
                  </select>
               </div>
               <label for="id_type_choice">
               Type
               </label>
            </div>
         </div>
      </div>
      <div class="row test">
         <div class="col s2">
            <div id="div_id_period" class="input-field " style="display: none;">
               <div class="select-wrapper select initialized">
                  <span class="caret">▼</span><input type="text" class="select-dropdown" readonly="true" data-activates="select-options-af71a392-11d1-9b85-c8e6-fd7ba7833d8d" value="Per week">
                  <ul id="select-options-af71a392-11d1-9b85-c8e6-fd7ba7833d8d" class="dropdown-content select-dropdown ">
                     <li class=""><span>Per day</span></li>
                     <li class=""><span>Per week</span></li>
                     <li class=""><span>Per month</span></li>
                     <li class=""><span>Per year</span></li>
                  </ul>
                  <select class="select initialized" id="id_period" name="period">
                     <option value="day">Per day</option>
                     <option value="week" selected="selected">Per week</option>
                     <option value="month">Per month</option>
                     <option value="year">Per year</option>
                  </select>
               </div>
               <label for="id_period">
               Period
               </label>
            </div>
         </div>
         <div class="col s2">
            <div id="div_id_product_type" class="input-field " style="display: block;">
               <div class="select-wrapper select initialized">
                  <span class="caret">▼</span><input type="text" class="select-dropdown" readonly="true" data-activates="select-options-05598cb4-a85e-7a34-3437-514c079cb9d3" value="Regular">
                  <ul id="select-options-05598cb4-a85e-7a34-3437-514c079cb9d3" class="dropdown-content select-dropdown ">
                     <li class=""><span>Regular</span></li>
                     <li class=""><span>Special</span></li>
                  </ul>
                  <select class="select initialized" id="id_product_type" name="product_type">
                     <option value="regular" selected="selected">Regular</option>
                     <option value="special">Special</option>
                  </select>
               </div>
               <label for="id_product_type">
               Product type
               </label>
            </div>
         </div>
         <div class="col s4">
            <div id="div_id_from_regular_product" class="input-field ">
               <div class="select-wrapper select initialized">
                  <span class="caret">▼</span><input type="text" class="select-dropdown" readonly="true" data-activates="select-options-733e336a-3c29-484f-eb4e-8f0a9d21690d" value="[P-01] : Loan: 300.00 $ / Brokerage Fees : 140.00 $">
                  <ul id="select-options-733e336a-3c29-484f-eb4e-8f0a9d21690d" class="dropdown-content select-dropdown ">
                     <li class=""><span>---------</span></li>
                     <li class=""><span>[P-01] : Loan: 300.00 $ / Brokerage Fees : 140.00 $</span></li>
                     <li class=""><span>[P-02] : Loan: 400.00 $ / Brokerage Fees : 185.00 $</span></li>
                     <li class=""><span>[P-03] : Loan: 500.00 $ / Brokerage Fees : 225.00 $</span></li>
                     <li class=""><span>[P-04] : Loan: 600.00 $ / Brokerage Fees : 265.00 $</span></li>
                     <li class=""><span>[P-05] : Loan: 700.00 $ / Brokerage Fees : 300.00 $</span></li>
                     <li class=""><span>[P-06] : Loan: 800.00 $ / Brokerage Fees : 335.00 $</span></li>
                     <li class=""><span>[P-07] : Loan: 900.00 $ / Brokerage Fees : 370.00 $</span></li>
                     <li class=""><span>[P-08] : Loan: 1000.00 $ / Brokerage Fees : 400.00 $</span></li>
                  </ul>
                  <select class="select initialized" id="id_from_regular_product" name="from_regular_product">
                     <option value="">---------</option>
                     <option value="1" selected="selected">[P-01] : Loan: 300.00 $ / Brokerage Fees : 140.00 $</option>
                     <option value="2">[P-02] : Loan: 400.00 $ / Brokerage Fees : 185.00 $</option>
                     <option value="3">[P-03] : Loan: 500.00 $ / Brokerage Fees : 225.00 $</option>
                     <option value="4">[P-04] : Loan: 600.00 $ / Brokerage Fees : 265.00 $</option>
                     <option value="5">[P-05] : Loan: 700.00 $ / Brokerage Fees : 300.00 $</option>
                     <option value="6">[P-06] : Loan: 800.00 $ / Brokerage Fees : 335.00 $</option>
                     <option value="7">[P-07] : Loan: 900.00 $ / Brokerage Fees : 370.00 $</option>
                     <option value="8">[P-08] : Loan: 1000.00 $ / Brokerage Fees : 400.00 $</option>
                  </select>
               </div>
               <label for="id_from_regular_product">
               Product
               </label>
            </div>
            <div id="div_id_from_special_product" class="input-field " style="display: none;">
               <div class="select-wrapper select initialized">
                  <span class="caret">▼</span><input type="text" class="select-dropdown" readonly="true" data-activates="select-options-46a25f05-4238-9a9f-9538-e0eb419d09a2" value="---------">
                  <ul id="select-options-46a25f05-4238-9a9f-9538-e0eb419d09a2" class="dropdown-content select-dropdown ">
                     <li class=""><span>---------</span></li>
                     <li class=""><span>[S-01] : Loan: 500.00 $ / Brokerage Fees : 170.00 $</span></li>
                     <li class=""><span>[S-02] : Loan: 600.00 $ / Brokerage Fees : 200.00 $</span></li>
                     <li class=""><span>[S-03] : Loan: 700.00 $ / Brokerage Fees : 225.00 $</span></li>
                     <li class=""><span>[S-04] : Loan: 800.00 $ / Brokerage Fees : 250.00 $</span></li>
                     <li class=""><span>[S-05] : Loan: 900.00 $ / Brokerage Fees : 280.00 $</span></li>
                     <li class=""><span>[S-06] : Loan: 1000.00 $ / Brokerage Fees : 300.00 $</span></li>
                  </ul>
                  <select class="select initialized" id="id_from_special_product" name="from_special_product">
                     <option value="">---------</option>
                     <option value="9">[S-01] : Loan: 500.00 $ / Brokerage Fees : 170.00 $</option>
                     <option value="10">[S-02] : Loan: 600.00 $ / Brokerage Fees : 200.00 $</option>
                     <option value="11">[S-03] : Loan: 700.00 $ / Brokerage Fees : 225.00 $</option>
                     <option value="12">[S-04] : Loan: 800.00 $ / Brokerage Fees : 250.00 $</option>
                     <option value="13">[S-05] : Loan: 900.00 $ / Brokerage Fees : 280.00 $</option>
                     <option value="14">[S-06] : Loan: 1000.00 $ / Brokerage Fees : 300.00 $</option>
                  </select>
               </div>
               <label for="id_from_special_product">
               Product
               </label>
            </div>
         </div>
         <div class="col s2">
            <div id="div_id_debit_frequency" class="input-field ">
               <div class="select-wrapper select initialized">
                  <span class="caret">▼</span><input type="text" class="select-dropdown" readonly="true" data-activates="select-options-4426e637-9e58-d48e-0b08-fd1645afbf5a" value="1 Month">
                  <ul id="select-options-4426e637-9e58-d48e-0b08-fd1645afbf5a" class="dropdown-content select-dropdown ">
                     <li class=""><span>1 Month</span></li>
                     <li class=""><span>2 weeks</span></li>
                     <li class=""><span>Bimonthly</span></li>
                     <li class=""><span>1 week</span></li>
                  </ul>
                  <select class="select initialized" id="id_debit_frequency" name="debit_frequency">
                     <option value="1month">1 Month</option>
                     <option value="2weeks">2 weeks</option>
                     <option value="bimonthly">Bimonthly</option>
                     <option value="1week">1 week</option>
                  </select>
               </div>
               <label for="id_debit_frequency">
               Debit frequency
               </label>
            </div>
         </div>
      </div>
      <div class="card-action">
         <div class="right-align"><i class="btn waves-effect waves-light btn white-text waves-input-wrapper" style=""><input type="button" name="apply" value="Apply" class="waves-button-input" id="button-id-apply"></i></div>
      </div>
   </div>
</form>
&#13;
&#13;
&#13;

这里的填充很烦人。即使display: none;允许我们使块消失,填充也始终存在。我怎么能在display: none;时删除它? flexbox可能是个不错的选择吗?我希望下拉菜单在它们不为空时沿着左边缘。我认为是这个地方的父母div,但我不知道如何解决它。每当我从Type中选择一个项目时,会出现一些底部下拉菜单,而其他菜单会消失,那么我希望完全删除空白区域。应该肯定地赞赏一个例子。

formlayouts.py

StatisticalToolsLayout = \
        CardContent(
            Row(
                Column('type_choice', css_class="s3"),
            ),
            Row(
                Column('period', css_class="s2"),
                Column('product_type', css_class="s2"),
                Column(
                    'from_regular_product',
                    'from_special_product',
                    css_class="col s4"),
                Column('debit_frequency', css_class="s2"),
            ),
            CardAction(
                Div(
                    Button('apply', _('Apply'), css_class='waves-effect waves-light btn white-text'),
                    css_class="right-align"),
            ),
        )

的index.html

{% block content %}
<div class="row main-content">
    <div class="col s10">
        <div class="card">
            <h5>{{ form.form_title }}</h5>
            {% crispy form form.helper %}
        </div>
    </div>
</div>
{% endcomment %}

1 个答案:

答案 0 :(得分:0)

尝试将display:none属性赋予其父div