fix regression with horizontal scroll so the sidenav moves
with the rest of the content when the sticky bar is visible Change-Id: I6c310405c15a8f74719b895f14eb5f4780277845
This commit is contained in:
@@ -19,7 +19,6 @@ $.ajaxSetup({
|
|||||||
|
|
||||||
/****** ON LOAD SET UP STUFF *********/
|
/****** ON LOAD SET UP STUFF *********/
|
||||||
|
|
||||||
var navBarIsFixed = false;
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// load json file for JD doc search suggestions
|
// load json file for JD doc search suggestions
|
||||||
@@ -411,7 +410,7 @@ false; // navigate across topic boundaries only in design docs
|
|||||||
var stylesheet = $('link[rel="stylesheet"][class="fullscreen"]');
|
var stylesheet = $('link[rel="stylesheet"][class="fullscreen"]');
|
||||||
setNavBarLeftPos(); // do this even if sidenav isn't fixed because it could become fixed
|
setNavBarLeftPos(); // do this even if sidenav isn't fixed because it could become fixed
|
||||||
// make sidenav behave when resizing the window and side-scolling is a concern
|
// make sidenav behave when resizing the window and side-scolling is a concern
|
||||||
if (navBarIsFixed) {
|
if (sticky) {
|
||||||
if ((stylesheet.attr("disabled") == "disabled") || stylesheet.length == 0) {
|
if ((stylesheet.attr("disabled") == "disabled") || stylesheet.length == 0) {
|
||||||
updateSideNavPosition();
|
updateSideNavPosition();
|
||||||
} else {
|
} else {
|
||||||
@@ -931,19 +930,19 @@ $(window).scroll(function(event) {
|
|||||||
if ($("#doc-col").height() < $("#side-nav").height()) {
|
if ($("#doc-col").height() < $("#side-nav").height()) {
|
||||||
shouldBeSticky = false;
|
shouldBeSticky = false;
|
||||||
}
|
}
|
||||||
|
// Account for horizontal scroll
|
||||||
|
var scrollLeft = $(window).scrollLeft();
|
||||||
|
// When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
|
||||||
|
if (sticky && (scrollLeft != prevScrollLeft)) {
|
||||||
|
updateSideNavPosition();
|
||||||
|
prevScrollLeft = scrollLeft;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't continue if the header is sufficently far away
|
// Don't continue if the header is sufficently far away
|
||||||
// (to avoid intensive resizing that slows scrolling)
|
// (to avoid intensive resizing that slows scrolling)
|
||||||
if (sticky == shouldBeSticky) {
|
if (sticky == shouldBeSticky) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Account for horizontal scroll
|
|
||||||
var scrollLeft = $(window).scrollLeft();
|
|
||||||
// When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
|
|
||||||
if (navBarIsFixed && (scrollLeft != prevScrollLeft)) {
|
|
||||||
updateSideNavPosition();
|
|
||||||
prevScrollLeft = scrollLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If sticky header visible and position is now near top, hide sticky
|
// If sticky header visible and position is now near top, hide sticky
|
||||||
if (sticky && !shouldBeSticky) {
|
if (sticky && !shouldBeSticky) {
|
||||||
@@ -2655,7 +2654,7 @@ var maxLevel = 1;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateSidenavFixedWidth() {
|
function updateSidenavFixedWidth() {
|
||||||
if (!navBarIsFixed) return;
|
if (!sticky) return;
|
||||||
$('#devdoc-nav').css({
|
$('#devdoc-nav').css({
|
||||||
'width' : $('#side-nav').css('width'),
|
'width' : $('#side-nav').css('width'),
|
||||||
'margin' : $('#side-nav').css('margin')
|
'margin' : $('#side-nav').css('margin')
|
||||||
@@ -2666,7 +2665,7 @@ function updateSidenavFixedWidth() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateSidenavFullscreenWidth() {
|
function updateSidenavFullscreenWidth() {
|
||||||
if (!navBarIsFixed) return;
|
if (!sticky) return;
|
||||||
$('#devdoc-nav').css({
|
$('#devdoc-nav').css({
|
||||||
'width' : $('#side-nav').css('width'),
|
'width' : $('#side-nav').css('width'),
|
||||||
'margin' : $('#side-nav').css('margin')
|
'margin' : $('#side-nav').css('margin')
|
||||||
|
Reference in New Issue
Block a user