1
我在固定寬度容器的頁面上使用固定自舉響應導航,即小設備頁面本身具有水平滾動,但導航採用頁面寬度。固定導航在寬頁面上的自舉彈出
其中一個導航按鈕有一個彈出窗口。問題是:當您將主頁滾動到右側時,彈出窗口顯示不正確或完全消失。
HTML
<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">Project name</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#dummy1">Dummy 1</a></li>
<li><a href="#dummy2">Dummy 2</a></li>
<li>
<a href="#contact" data-placement="bottom" data-trigger="click" data-container="body" data-toggle="popover" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?">Contact Popover</a>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
<div id="main" class="container">
<div class="row">
<h1>Dummy 1</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,</p>
</div>
</div>
CSS
body {
padding-top: 50px;
width: 1700px;
}
下面是一個例子:https://jsfiddle.net/nnxfk7s6/8/
- 運行片斷
- 新聞 「聯繫酥料餅」 看到酥料餅
- 滾動頁面右側
- 新聞「聯繫酥料餅」再看看沒有完全呈現酥料餅
我試圖與酥料餅的container
和viewport
性能發揮,但它並沒有解決問題。 (http://getbootstrap.com/javascript/#popovers-options)
我懷疑你可能需要用'onscroll'處理這個問題看看這個答案http://stackoverflow.com/a/22606657 – hammus
@hammus謝謝你的建議,問題是關於垂直位置,但也可以採用水平位置。會試試這個! –