2017-11-02 15:46:43 +01:00
|
|
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
2017-09-28 17:05:46 +02:00
|
|
|
|
2017-11-01 10:09:47 +01:00
|
|
|
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
|
|
|
|
|
|
|
|
import * as scroll from '../../../assets/jquery.scrollTo.min.js';
|
|
|
|
|
2017-09-28 17:05:46 +02:00
|
|
|
@Component({
|
|
|
|
selector: 'toc',
|
|
|
|
templateUrl: '/toc.component.html',
|
2017-11-09 15:18:02 +01:00
|
|
|
styleUrls: ['./toc.component.css'],
|
2017-09-28 17:05:46 +02:00
|
|
|
providers: []
|
|
|
|
})
|
2017-11-01 10:09:47 +01:00
|
|
|
export class TocComponent implements OnInit{
|
|
|
|
|
2017-09-28 17:05:46 +02:00
|
|
|
private headers = new Array();
|
|
|
|
|
2017-11-02 15:46:43 +01:00
|
|
|
@Output()
|
2017-11-06 10:57:13 +01:00
|
|
|
setPage:EventEmitter<number> = new EventEmitter<number>();
|
2017-11-02 15:46:43 +01:00
|
|
|
|
2017-11-27 14:40:16 +01:00
|
|
|
ngOnInit(){
|
2017-09-28 17:05:46 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-11-06 10:57:13 +01:00
|
|
|
scrollToElemID(elemID, _page){
|
2017-11-01 10:09:47 +01:00
|
|
|
console.log("going to id:"+elemID)
|
2017-11-06 10:57:13 +01:00
|
|
|
var page = parseInt(_page)
|
|
|
|
this.setPage.emit(page);
|
2017-11-08 14:54:22 +01:00
|
|
|
scroll("#"+elemID, {}, {offset: top});
|
2017-11-01 10:09:47 +01:00
|
|
|
}
|
|
|
|
|
2017-09-28 17:05:46 +02:00
|
|
|
}
|