2016-11-08 52 views
-1

我有一个div在我的脚注,我想放在一个下拉。 我试过这个,但它不会把div放在按钮里面。我在这里找到 http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_dropdown-menu-dropup&stacked=h把股利放在下跌

这就是它的做着 https://jsfiddle.net/tmfmtocf/ 有谁知道如何做到这一点? 我的页脚...

<footer id="chat"> 
     <div class="dropup"> 
      <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"> 
       Dropup Example 
       <span class="caret"></span> 
      </button> 
      <div class="boxContainer"> 
       <h2 style="color:red;">Chat</h2> 
       <div id="scrollBox" style="height:100px;width:100%;font:16px/26px Georgia, Garamond, Serif;overflow:auto;"> 
        <ul id="discussion"></ul> 
       </div> 
       <input type="text" id="message" /> 
       <input type="button" id="sendmessage" value="Send" /> 
       <input type="hidden" id="displayname" /> 
      </div> 
     </div> 
</footer> 

谢谢!

+0

什么你指的是作为降-向上? –

+0

我想要这个http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_dropdown-menu-dropup&stacked=h但用div而不是列表。我尝试修改示例中的代码,但它没有工作。 –

+0

@ShaeLaRie StackOverflow不是一个代码写入服务。你需要自己完成这项工作,然后回到你遇到的具体问题。那么,我们会帮你解决它。 –

回答

0

如果您已经引导加载你的页面,那么你只需要类的dropdown-menu添加到您的boxContainer像这样:

<footer id="chat"> 
     <div class="dropup"> 
      <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"> 
       Dropup Example 
       <span class="caret"></span> 
      </button> 
      <div class="boxContainer dropdown-menu"> 
       <h2 style="color:red;">Chat</h2> 
       <div id="scrollBox" style="height:100px;width:100%;font:16px/26px Georgia, Garamond, Serif;overflow:auto;"> 
        <ul id="discussion"></ul> 
       </div> 
       <input type="text" id="message" /> 
       <input type="button" id="sendmessage" value="Send" /> 
       <input type="hidden" id="displayname" /> 
      </div> 
     </div> 
</footer> 

小提琴演示Fiddle

+0

它正在显示,但由于您的div位于页面的顶部,所以无法看到它,因为菜单已在上方显示。我修改了小提琴的底部。 –

+0

你是对的,谢谢! –

+0

没问题,很高兴提供帮助 –