Make desktop docs-nav sticky on scroll
This commit is contained in:
parent
40f1949654
commit
3ae46e6ba1
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
<div id="restAPI" *ngIf="restTabActivated">
|
<div id="restAPI" *ngIf="restTabActivated">
|
||||||
|
|
||||||
<div class="doc-nav-desktop">
|
<div class="doc-nav-desktop" [ngClass]="docsNavPosition">
|
||||||
<p>Placeholder.</p>
|
Placeholder.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="doc-content">
|
<div class="doc-content">
|
||||||
|
@ -74,9 +74,18 @@ li.nav-item {
|
|||||||
|
|
||||||
.doc-nav-desktop {
|
.doc-nav-desktop {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-nav-desktop.relative {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.doc-nav-desktop.fixed {
|
||||||
|
float: unset;
|
||||||
|
position: fixed;
|
||||||
|
top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.doc-content {
|
.doc-content {
|
||||||
width: 75%;
|
width: 75%;
|
||||||
float: right;
|
float: right;
|
||||||
|
@ -17,6 +17,7 @@ export class ApiDocsComponent implements OnInit {
|
|||||||
code: any;
|
code: any;
|
||||||
baseNetworkUrl = '';
|
baseNetworkUrl = '';
|
||||||
@Input() restTabActivated: Boolean;
|
@Input() restTabActivated: Boolean;
|
||||||
|
docsNavPosition = "relative";
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
@ -35,6 +36,16 @@ export class ApiDocsComponent implements OnInit {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//to toggle fixed menu for desktop navigation
|
||||||
|
let that = this;
|
||||||
|
window.addEventListener('scroll', function() {
|
||||||
|
if( window.pageYOffset > 182 ) {
|
||||||
|
that.docsNavPosition = "fixed";
|
||||||
|
} else {
|
||||||
|
that.docsNavPosition = "relative";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (document.location.port !== '') {
|
if (document.location.port !== '') {
|
||||||
this.hostname = `${this.hostname}:${document.location.port}`;
|
this.hostname = `${this.hostname}:${document.location.port}`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user