diff --git a/lib/components/SideMenu/side-menu.js b/lib/components/SideMenu/side-menu.js index 79509605..3b52bbac 100644 --- a/lib/components/SideMenu/side-menu.js +++ b/lib/components/SideMenu/side-menu.js @@ -4,9 +4,10 @@ import {RedocComponent, BaseComponent} from '../base'; import SchemaManager from '../../utils/SchemaManager'; import {NgZone, ChangeDetectionStrategy} from 'angular2/core'; import {redocEvents} from '../../events'; -import scrollParent from 'scrollparent'; +import detectScollParent from 'scrollparent'; import {BrowserDomAdapter} from 'angular2/platform/browser'; +import {global} from 'angular2/src/facade/lang'; const CHANGE = { NEXT : 1, @@ -33,10 +34,7 @@ export default class SideMenu extends BaseComponent { this.zone = zone; this.adapter = new BrowserDomAdapter(); - this.scrollParent = scrollParent(document.querySelector('side-menu')); - /*if (this.scrollParent.scrollHeight === this.scrollParent.clientHeight) { - this.scrollParent = window; - }*/ + this.scrollParent = detectScollParent(document.querySelector('side-menu')); // for some reason constructor is not run inside zone // as workaround running it manually @@ -55,7 +53,7 @@ export default class SideMenu extends BaseComponent { } hashScroll(evt) { - let hash = window.location.hash; + let hash = global.location.hash; if (!hash) return; hash = hash.substr(1); @@ -71,7 +69,7 @@ export default class SideMenu extends BaseComponent { let view = document.querySelector('redoc'); this.viewBoxTop = view.offsetTop; this.adapter.on(this.scrollParent, 'scroll', () => this.scrollHandler()); - this.adapter.on(window, 'hashchange', evt => this.hashScroll(evt)); + this.adapter.on(global, 'hashchange', evt => this.hashScroll(evt)); } activateAndScroll(idx, methodIdx) {