2016-11-08 98 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

沒問題,很高興提供幫助 –