Fix scroll flicker
See https://gitlab.com/gitlab-org/gitlab-ce/issues/34407 - Revert https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12399 - Update https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12299 throttle/debounce to happen immediately and cleanup
This commit is contained in:
parent
585e6aa5b2
commit
291309f431
1 changed files with 5 additions and 3 deletions
|
@ -10,6 +10,8 @@ import Cookies from 'js-cookie';
|
|||
|
||||
this.$sidebarInner = this.sidebar.find('.issuable-sidebar');
|
||||
this.$navGitlab = $('.navbar-gitlab');
|
||||
this.$layoutNav = $('.layout-nav');
|
||||
this.$subScroll = $('.sub-nav-scroll');
|
||||
this.$rightSidebar = $('.js-right-sidebar');
|
||||
|
||||
this.removeListeners();
|
||||
|
@ -27,14 +29,14 @@ import Cookies from 'js-cookie';
|
|||
Sidebar.prototype.addEventListeners = function() {
|
||||
const $document = $(document);
|
||||
const throttledSetSidebarHeight = _.throttle(this.setSidebarHeight.bind(this), 20);
|
||||
const debouncedSetSidebarHeight = _.debounce(this.setSidebarHeight.bind(this), 200);
|
||||
const slowerThrottledSetSidebarHeight = _.throttle(this.setSidebarHeight.bind(this), 200);
|
||||
|
||||
this.sidebar.on('click', '.sidebar-collapsed-icon', this, this.sidebarCollapseClicked);
|
||||
$('.dropdown').on('hidden.gl.dropdown', this, this.onSidebarDropdownHidden);
|
||||
$('.dropdown').on('loading.gl.dropdown', this.sidebarDropdownLoading);
|
||||
$('.dropdown').on('loaded.gl.dropdown', this.sidebarDropdownLoaded);
|
||||
$(window).on('resize', () => throttledSetSidebarHeight());
|
||||
$document.on('scroll', () => debouncedSetSidebarHeight());
|
||||
$document.on('scroll', () => slowerThrottledSetSidebarHeight());
|
||||
$document.on('click', '.js-sidebar-toggle', function(e, triggered) {
|
||||
var $allGutterToggleIcons, $this, $thisIcon;
|
||||
e.preventDefault();
|
||||
|
@ -213,7 +215,7 @@ import Cookies from 'js-cookie';
|
|||
};
|
||||
|
||||
Sidebar.prototype.setSidebarHeight = function() {
|
||||
const $navHeight = this.$navGitlab.outerHeight();
|
||||
const $navHeight = this.$navGitlab.outerHeight() + this.$layoutNav.outerHeight() + (this.$subScroll ? this.$subScroll.outerHeight() : 0);
|
||||
const diff = $navHeight - $(window).scrollTop();
|
||||
if (diff > 0) {
|
||||
this.$rightSidebar.outerHeight($(window).height() - diff);
|
||||
|
|
Loading…
Reference in a new issue