fix: update fix for #276 to not use className checking

This commit is contained in:
Roman Hotsiy 2017-06-02 09:37:49 +03:00
parent f50bfb1823
commit 4dd8a0acdf
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 7 additions and 3 deletions

View File

@ -7,7 +7,8 @@
<div class="background"> <div class="background">
<div class="background-actual"> </div> <div class="background-actual"> </div>
</div> </div>
<div class="menu-content" sticky-sidebar [scrollParent]="options.$scrollParent" [scrollYOffset]="options.scrollYOffset"> <div class="menu-content" sticky-sidebar [disable]="specLoading"
[scrollParent]="options.$scrollParent" [scrollYOffset]="options.scrollYOffset">
<div class="menu-header"> <div class="menu-header">
<api-logo> </api-logo> <api-logo> </api-logo>
<redoc-search> </redoc-search> <redoc-search> </redoc-search>

View File

@ -12,6 +12,7 @@ export class StickySidebar implements OnInit, OnDestroy {
$redocEl: any; $redocEl: any;
@Input() scrollParent:any; @Input() scrollParent:any;
@Input() scrollYOffset:any; @Input() scrollYOffset:any;
@Input() disable:any;
constructor(elementRef:ElementRef) { constructor(elementRef:ElementRef) {
this.$element = elementRef.nativeElement; this.$element = elementRef.nativeElement;
@ -33,14 +34,16 @@ export class StickySidebar implements OnInit, OnDestroy {
updatePosition() { updatePosition() {
var stuck = false; var stuck = false;
if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop) { if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop && !this.disable) {
this.stick(); this.stick();
stuck = true; stuck = true;
} else { } else {
this.unstick(); this.unstick();
} }
if ( this.scrollY + window.innerHeight - this.scrollYOffset() >= this.$redocEl.scrollHeight && this.$element.parentElement.parentElement.className != 'loading') {
if ( this.scrollY + window.innerHeight - this.scrollYOffset()
>= this.$redocEl.scrollHeight && !this.disable) {
this.stickBottom(); this.stickBottom();
stuck = true; stuck = true;
} else { } else {