当前位置: 动力学知识库 > 问答 > 编程问答 >

html - different dropdown buttons open the same menu in bootstrap

问题描述:

Is it possible?

I tried the following code and it works. However, when the buttons are placed at different div's on the page, the menu is positioned at the wrong places.

<button class="btn btn-default" data-toggle="dropdown" data-target="#menu">Hello1</button>

<button class="btn btn-default" data-toggle="dropdown" data-target="#menu">Hello1</button>

<div class="dropdown">

<ul class="dropdown-menu" role="menu" id="menu">

<li>Hi</li>

</ul>

</div>

http://jsfiddle.net/isherwood/mE62z/

网友答案:

It doesn't look like Bootstrap accommodates this. Cloning might work:

http://jsfiddle.net/isherwood/mE62z/5

$('#menu').clone().attr('id','menu2').appendTo('body');
$('#menu2').addClass('pull-right');
分享给朋友:
您可能感兴趣的文章:
随机阅读: