enter image description here我在使用鼠标滚动实现补充工具栏时遇到了问题。如果我用鼠标手动拖动滚动条,侧边栏会留下一些空白区域,无法使用页面高度进行映射。
$(window).on('scroll resize', function() {
var marginTop = $(window).scrollTop();
var marginFooter = $('#divFooter').height();
var limit = $("#divMain").height() - $("#navMenu").height();
if (marginTop < limit) {
$("#navMenu").css("margin-top", marginTop);
}
});
&#13;
#navMenu {
padding-left: 0;
padding-right: 0;
float: left;
height: 100%;
z-index: 10001;
}
#divMain {
padding: 0 20px;
overflow: auto;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="navMenu">
<ucl:ucNavMenu ID="ucNavMenu" runat="server" />
</div>
<div class="clearfix visible-xs-block"></div>
//div for entire page content inculding page header menu
<div id="divMain"> content </div>
&#13;