Customize mobile nav button appearance point
Since there are different numbers of topics across bitcoin, liquid, bisq, faq, etc.
This commit is contained in:
		
							parent
							
								
									086b14e816
								
							
						
					
					
						commit
						5f9bc4497a
					
				| @ -22,7 +22,7 @@ | ||||
|           </div> | ||||
|         </div> | ||||
| 
 | ||||
|         <div id="mobile-top-doc-nav" class="hide-on-desktop"><app-api-docs-nav [network]="{ val: network$ | async }"></app-api-docs-nav></div> | ||||
|         <div id="mobile-top-doc-nav" #mobileFixedApiNav class="hide-on-desktop"><app-api-docs-nav [network]="{ val: network$ | async }"></app-api-docs-nav></div> | ||||
| 
 | ||||
|         <div class="api-category" *ngIf="network.val !== 'bisq' && network.val !== 'liquid'"> | ||||
| 
 | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| import { Component, OnInit, Input } from '@angular/core'; | ||||
| import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core'; | ||||
| import { Env, StateService } from 'src/app/services/state.service'; | ||||
| import { Observable, merge, of } from 'rxjs'; | ||||
| import { SeoService } from 'src/app/services/seo.service'; | ||||
| @ -17,6 +17,7 @@ export class ApiDocsComponent implements OnInit { | ||||
|   code: any; | ||||
|   baseNetworkUrl = ''; | ||||
|   @Input() restTabActivated: Boolean; | ||||
|   @ViewChild( "mobileFixedApiNav", { static: false } ) mobileFixedApiNav: ElementRef; | ||||
|   desktopDocsNavPosition = "relative"; | ||||
|   showFloatingDocsNav = false; | ||||
|   mobileMenuOpen = true; | ||||
| @ -26,6 +27,16 @@ export class ApiDocsComponent implements OnInit { | ||||
|     private seoService: SeoService, | ||||
|   ) { } | ||||
| 
 | ||||
|   ngAfterViewInit() { | ||||
|     const that = this; | ||||
|     setTimeout( () => { | ||||
|       window.addEventListener('scroll', function() { | ||||
|         that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative"; | ||||
|         that.showFloatingDocsNav = ( window.pageYOffset > ( that.mobileFixedApiNav.nativeElement.offsetHeight + 188 ) ) ? true : false; | ||||
|       }); | ||||
|     }, 1 ); | ||||
|   } | ||||
| 
 | ||||
|   ngOnInit(): void { | ||||
|     this.env = this.stateService.env; | ||||
|     this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`); | ||||
| @ -38,13 +49,6 @@ export class ApiDocsComponent implements OnInit { | ||||
|       }) | ||||
|     ); | ||||
| 
 | ||||
|     //to toggle fixed menu for desktop navigation
 | ||||
|     const that = this; | ||||
|     window.addEventListener('scroll', function() { | ||||
|       that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative"; | ||||
|       that.showFloatingDocsNav = ( window.pageYOffset > 1425 ) ? true : false; | ||||
|     }); | ||||
| 
 | ||||
|     if (document.location.port !== '') { | ||||
|       this.hostname = `${this.hostname}:${document.location.port}`; | ||||
|     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user