单击向下箭头时如何使整个div可扩展?

时间:2015-09-11 19:29:08

标签: javascript jquery

我试图在单击向下箭头时使整个#main-slider容器可展开。 a.next-down-chevron,我想要展示的唯一两件事是标题工程和向下箭头。我用谷歌搜索但只设法将三个容器隐藏在中间,所有的旋转木马箭头和标签仍在显示。我的代码:

 <section id="main-slider" class="no-margin wow fadeInDown">
        <a class="prev hidden-xs" href="#main-slider" data-slide="prev">
          <i class="fa fa-chevron-left"></i>
        </a>
        <a class="next hidden-xs" href="#main-slider" data-slide="next">
          <i class="fa fa-chevron-right"></i>
        </a>
        <div class="carousel slide" data-ride="carousel">

            <ol class="carousel-indicators">
                <li data-target="#main-slider" data-slide-to="0" class="active"></li>
                <li data-target="#main-slider" data-slide-to="1"></li>
                <li data-target="#main-slider" data-slide-to="2"></li>
            </ol>

          <div class="engineering-section">
            <div class="engineering-section-title title-text text-center">Engineering</div>
              <div class="down-button bounceInDown animated">
                  <a class="next-down-chevron" href="#"><i class="fa fa-chevron-down"></i></a>
              </div>

        <div class="carousel-inner">

            <div class="item active">
              <div class="card-container">
                <div class="col-md-4">
                  <div class="card-section">
                    <div class="mdl-card__media">
                      <img src="img/engineer-1.jpg">
                    </div>
                    <div class="mdl-card__supporting-text">
                      <span class="mdl-typography--font-light mdl-typography--subhead">V8.8 aspenONE Enginnering Suite (May 2015)</span>
                      <div class="checksum">
                        <a class="info_checksum" href="#">Checksum</a>
                      </div>
                    </div><!--end supporting text-->
                    <div class="card_actions">
                       <a class="card-links" href="#">
                         Download Now
                         <i class="fa fa-chevron-right"></i>
                       </a>
                    </div><!--end card_actions-->
                  </div><!--end card-section-->
                </div>

              <div class="col-md-4">
                 <div class="card-section">
                  <div class="mdl-card__media">
                    <img src="img/engineer-2.jpg">
                  </div>
                  <div class="mdl-card__supporting-text">
                    <span class="mdl-typography--font-light mdl-typography--subhead">V8.8 aspenONE Process Manuals and Process Tools</span>
                    <div class="checksum">
                    <a class="info_checksum" href="#">Checksum</a>
                    </div>
                  </div>
                  <div class="card_actions">
                     <a class="card-links" href="#">
                       Download Now
                       <i class="fa fa-chevron-right"></i>
                     </a>
                  </div><!--end card_actions-->
                </div><!--end card-section-->
              </div>

              <div class="col-md-4">
                <div class="card-section"> 
                <div class="mdl-card__media">
                  <img src="img/engineer-3.jpg">
                </div>
                <div class="mdl-card__supporting-text">
                  <span class="mdl-typography--font-light mdl-typography--subhead">Aspen License Deployment Assistant</span>
                  <div class="checksum">
                    <a class="info_checksum" href="#">Checksum</a>
                  </div>
                </div>
                <div class="card_actions">
                   <a class="card-links" href="#">
                     Download Now
                     <i class="fa fa-chevron-right"></i>
                   </a>
                </div><!--end card_actions-->
              </div><!--end card-section-->
           </div><!--end col-md-4-->  
        </div><!--end card-container-->
      </div>
      <div class="item">
        <div class="card-container content-one">
                <div class="col-md-4">
                  <div class="card-section">
                    <div class="mdl-card__media">
                      <img src="img/1.jpg">
                    </div>
                    <div class="mdl-card__supporting-text">
                      <span class="mdl-typography--font-light mdl-typography--subhead">V8.8 aspenONE Enginnering Suite (May 2015)</span>
                      <div class="checksum">
                        <a class="info_checksum" href="#">Checksum</a>
                      </div>
                    </div><!--end supporting text-->
                    <div class="card_actions">
                       <a class="card-links" href="#">
                         Download Now
                         <i class="fa fa-chevron-right"></i>
                       </a>
                    </div><!--end card_actions-->
                  </div><!--end card-section-->
                </div>

              <div class="col-md-4">
                 <div class="card-section">
                  <div class="mdl-card__media">
                    <img src="img/2.jpg">
                  </div>
                  <div class="mdl-card__supporting-text">
                    <span class="mdl-typography--font-light mdl-typography--subhead">V8.8 aspenONE Process Manuals and Process Tools</span>
                    <div class="checksum">
                    <a class="info_checksum" href="#">Checksum</a>
                    </div>
                  </div>
                  <div class="card_actions">
                     <a class="card-links" href="#">
                       Download Now
                       <i class="fa fa-chevron-right"></i>
                     </a>
                  </div><!--end card_actions-->
                </div><!--end card-section-->
              </div>

              <div class="col-md-4">
                <div class="card-section"> 
                <div class="mdl-card__media">
                  <img src="img/3.jpg">
                </div>
                <div class="mdl-card__supporting-text">
                  <span class="mdl-typography--font-light mdl-typography--subhead">Aspen License Deployment Assistant</span>
                  <div class="checksum">
                    <a class="info_checksum" href="#">Checksum</a>
                  </div>
                </div>
                <div class="card_actions">
                   <a class="card-links" href="#">
                     Download Now
                     <i class="fa fa-chevron-right"></i>
                   </a>
                </div><!--end card_actions-->
              </div><!--end card-section-->
           </div><!--end col-md-4-->  
        </div><!--end card-container-->
      </div>
    </div><!--end engineering-->
  </div>
 </div>

</section>

1 个答案:

答案 0 :(得分:0)

如果你想将标题和开启者留在div的中间,你唯一的选择就是在div之外有一个副本Title和opener。并在点击时隐藏这些并显示主滑块,如下所示:

$('a.next-down-chevron').click(function(){
    $('#engineering-trigger').hide();
    $('#main-slider').show();
});

看到这个小提琴:https://jsfiddle.net/f5pkmoq0/