我创建了带语义ui的侧边栏,但是当我向下滚动页面并切换侧边栏时,我的页面总是返回顶部。为了清楚起见,我有位置:使用按钮切换侧边栏固定导航,所以当我切换侧边栏时我需要页面停留在同一个地方。
HTML
<div class="ui left vertical menu sidebar slide along">
<h3 class="sidebar-heading">Menu</h3>
<a class="item">
SIDEBAR ITEM
<i class="fa fa-long-arrow-right pull-right"></i>
</a>
<a class="item">
SIDEBAR ITEM
<i class="fa fa-long-arrow-right pull-right"></i>
</a>
<a class="item">
SIDEBAR ITEM
<i class="fa fa-long-arrow-right pull-right"></i>
</a>
<a class="item">
SIDEBAR ITEM
<i class="fa fa-long-arrow-right pull-right"></i>
</a>
<a class="item">
SIDEBAR ITEM
<i class="fa fa-long-arrow-right pull-right"></i>
</a>
<div class="pusher">
<a href="#" class="menu-trigger"></a>
</div><!-- ENd of pusher -->
JS
$('.menu-trigger').click(function() {
$('.ui.sidebar').sidebar('toggle');
});