From 2c836f8107b71af29bcccf394fff87863e664b01 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 14 Jun 2017 11:12:07 +0300 Subject: [PATCH] fix: sticky sidebar fix --- .travis.yml | 1 + lib/shared/components/StickySidebar/sticky-sidebar.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 096618eb..421cd2f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ branches: - releases matrix: include: + - env: JOB=unit - env: JOB=e2e-guru fast_finish: true allow_failures: diff --git a/lib/shared/components/StickySidebar/sticky-sidebar.ts b/lib/shared/components/StickySidebar/sticky-sidebar.ts index 70519a7d..69a8518d 100644 --- a/lib/shared/components/StickySidebar/sticky-sidebar.ts +++ b/lib/shared/components/StickySidebar/sticky-sidebar.ts @@ -1,12 +1,12 @@ 'use strict'; -import { Directive, ElementRef, Input, OnInit, OnDestroy } from '@angular/core'; +import { Directive, ElementRef, Input, OnInit, OnDestroy, OnChanges} from '@angular/core'; import { BrowserDomAdapter as DOM } from '../../../utils/browser-adapter'; @Directive({ selector: '[sticky-sidebar]' }) -export class StickySidebar implements OnInit, OnDestroy { +export class StickySidebar implements OnInit, OnDestroy, OnChanges { $element: any; cancelScrollBinding: any; $redocEl: any; @@ -89,6 +89,11 @@ export class StickySidebar implements OnInit, OnDestroy { requestAnimationFrame(() => this.updatePosition()); } + ngOnChanges() { + if (this.disable) return; + this.updatePosition(); + } + ngOnDestroy() { this.unbind(); }