左侧导航菜单中的下拉列表无法打开

时间:2016-08-08 14:08:47

标签: javascript html5 css3 drop-down-menu twitter-bootstrap-3

我在导航菜单中放入了一个下拉菜单。问题是:

1。菜单根本无法打开

2. 下拉菜单应该向右打开而不是从底部打开(如图片所示)

3。所选的链接应根据选择进行更改,因此默认情况下应该是选项A,然后我可以点击下拉选项B或C等。

BONUS 下拉链接应该像标签一样,并像图片一样更改其下的链接:

Dropdown open to the right

我一直在寻找如何创建如上图所示的下拉菜单,但我似乎无法找到答案。我还是新手,我肯定会欣赏一些关于如何完成这项工作的建议谢谢!

FIDDLE:https://jsfiddle.net/f4e42hex/2/

HTML:

          <div id="sidebar-wrapper2">

         <!-- Sidebar -->
        <div class="topfilter">
<input type="checkbox" style="vertical-align:middle;">

 <div class="bs-example">
 <div class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Option 1 <b class="caret"></b></a>
        <ul class="dropdown-menu">
            <li><a href="#">Option 2</a></li>
            <li><a href="#">Option 3</a></li>
            <li><a href="#">Option 4</a></li>
             <li><a href="#">Option 5</a></li>
              <li><a href="#">Option 6</a></li>


        </ul>
    </div>

 </div>
   </div>
   </div>  
  <div id="sidebar-wrapper">


    <ul class="sidebar-nav">


      <li>
        <a href="#/content">
        Option 1 - A
        </a>
      </li>
              <li>
        <a href="#/topics">
         Option 1 - B
        </a>
      </li>
              <li>
        <a href="#">
        Option 1 - C
        </a>
      </li>
              <li>
        <a href="#">
         Option 1 - D
        </a>
      </li>
      <li>
        <a href="#"> Option 1 - E</a>
      </li>
      <li>
        <a href="#"> Option 1 - F</a>
      </li>
      <li>
        <a href="#"> Option 1 - G</a>
      </li>
      <li>
        <a href="#"> Option 1 - H</a>
      </li>
      <li>
        <a href="#"> Option 1 - I/a>
      </li>
      <li>
        <a href="#"> Option 1 - J/a>
      </li>
      <li>
        <a href="#"> Option 1 - K</a>
      </li>

        <div class="bottomfilter">

   </div>

    </ul>
  </div>
  <!-- /#sidebar-wrapper -->



  <div class="content" style="min-height:90%; background:white;"  >



  </div>
  <div class="push"></div>

<footer class="footer">







        </footer>

CSS:

a {outline:none !important;}

html,
body,
.wrap {
  height: 100%;
}

.wrap {
  box-sizing: border-box;
}

form {
  height: 100%
}

.wrap {
  min-height: 100%;
  height: auto !important;
  height: 100%;
  margin-bottom: -60px;
  /* for sticky footer to not go below page */
  /* for sticky header to not overlap content */
}

.push,
.footer {
  height: 60px;
}



.footer {
  background-color: #ebebeb;
  height: 60px;
  width: 100%;
  position: fixed;
  bottom: 0;   
}

.content {
  position: absolute;
  width: 100%;
  top: 120px;
  background-color: yellow;
  z-index: 0;
}


#sidebar-wrapper {
  z-index: 1000;
  position: fixed;
  left: 142px;
height:95%;
  width: 0; bottom:0; top:50px;
  height:auto; border-top:2px solid #666;
  margin-left: -142px;
  overflow-y: auto; overflow-x:hidden;
  background: #eee;
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  transition: all 0.5s ease;
}

#sidebar-wrapper2 {
  z-index: 1000;
  position: fixed;
  left: 142px;
  top:0; 
  margin-bottom: 0px;
  width:100%;
  min-height:55px;  height:auto; 
  margin-left: -142px;
  background: #eee; 
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  transition: all 0.5s ease;
}

.filtertitle { position:relative; display:inline-block; color:#000; width:auto; text-indent:10px;  }

.topfilter { max-width:100%; vertical-align:middle;  position:fixed; display:block; text-align:left; background-color:#eee; }


.bottomfilter {border-top: solid #666 1px; width:100%; height:auto;  position:relative; display:block; text-align:left; background-color:#eee;  }


#wrapper.toggled #sidebar-wrapper {
  width: 200px;  
}

#wrapper.toggled #sidebar-wrapper2 {
  width: 200px;  
}


#page-content-wrapper {
  width: 100%;
  position: absolute;
  padding: 15px;
}

   #wrapper.toggled #page-content-wrapper {
  position: absolute;
  margin-right: -200px;
}


/* Sidebar Styles */

.sidebar-nav {
  position: absolute;
  top: 0px;
  width:inherit; min-width:100%;  
  margin: 0;
  padding: 0;  
  list-style: none;
}

.sidebar-nav li {
  text-indent: 20px;
  line-height: 40px; 
}

.sidebar-nav li a {
  display: block; 
  text-decoration: none;
  color: #999999;
}

.sidebar-nav li a:hover {
  text-decoration: none;
  color: #333; 
  background: rgba(255, 255, 255, 0.6);
}

.sidebar-nav li a:active,
.sidebar-nav li a:focus {
  text-decoration: none;
}

.sidebar-nav > .sidebar-brand {
  height: 65px;
  font-size: 18px;
  line-height: 60px;
}

.sidebar-nav > .sidebar-brand a {
  color: #999999;
}

.sidebar-nav > .sidebar-brand a:hover {
  color: #fff;
  background: none;
}

@media screen and (min-width:768px) {
  #wrapper {
    padding-left: 300px;
  }
  #wrapper.toggled {
    padding-left: 0;
  }


  #wrapper.toggled #sidebar-wrapper {
    width: 0;
  }
  #page-content-wrapper {
    padding: 20px;
    position: relative;
  }
  #wrapper.toggled #page-content-wrapper {
    position: relative;
    margin-right: 0;
  }
}


@media screen and (max-width:1526px) {

  .content,
  .footer {
    width: 82%;
    right: 0; 
  }
  .header {width:82%;}

    #sidebar-wrapper {
    width: 18%; 
  }
    #sidebar-wrapper2 {
    width: 18%; 
  }

}


@media screen and (max-width:1059px) {

  .content,
  .footer {
    width: 80%;
    right: 0; 
  }

  .header {width:80%;}

    #sidebar-wrapper {
    width: 20%; 
  }

     #sidebar-wrapper2 {
    width: 20%; 
  }
}   

     @media screen and (min-width:1527px) {

  .content,
  .footer {
    width: 85%;
    right: 0; 
  }
  .header {width:85%;}
    #sidebar-wrapper {
    width: 15%; 
  }

     #sidebar-wrapper2 {
    width: 15%; 
  }


}

        @media screen and (max-width:991px) {
          .content,
  .footer {
    width: 100%;
    right: 0; 
  }

  .filtertitle {display:none;}

    #sidebar-wrapper {
    width:0;   
  }

    #sidebar-wrapper2 {
    width:0;   
  }

0 个答案:

没有答案