您可以請看看this Demo並讓我知道在JavaScript/jQuery中是否有方法將Bootstrap Panel的寬度設置爲非活動標籤?關於使用Bootstrap Inactive標籤獲取面板的問題
<div class="container">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Chart</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">Check The Chart Tab</div>
<div role="tabpanel" class="tab-pane" id="profile"><div class="row"><div class="col-md-6"><div class="panel panel-default">
<div class="panel-heading">Panel heading without title</div>
<div class="panel-body">
Panel content
</div>
</div></div><div class="col-md-6"><div class="panel panel-default">
<div class="panel-heading">Panel heading without title</div>
<div class="panel-body">
Panel content
</div>
</div>
</div>
</div>
</div>
</div>
,這將返回0
var chartWidth = $(".panel-body").width();
console.info(chartWidth);
其返回-30對我來說 –
@DestinationDesigns,謝謝,但如何獲得的實際尺寸是多少? – Suffii
你想要'panel-body'的'width'還是整個'tab'? – DavidDomain