Remove doc scroll listener after navigating away
This commit is contained in:
		
							parent
							
								
									7fecea9cca
								
							
						
					
					
						commit
						5b4d394039
					
				@ -50,9 +50,7 @@ export class ApiDocsComponent implements OnInit, AfterViewInit {
 | 
				
			|||||||
          document.getElementById( this.route.snapshot.fragment ).scrollIntoView();
 | 
					          document.getElementById( this.route.snapshot.fragment ).scrollIntoView();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      window.addEventListener('scroll', function() {
 | 
					      window.addEventListener('scroll', that.onDocScroll, { passive: true });
 | 
				
			||||||
        that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative";
 | 
					 | 
				
			||||||
      }, { passive: true} );
 | 
					 | 
				
			||||||
    }, 1 );
 | 
					    }, 1 );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -87,6 +85,14 @@ export class ApiDocsComponent implements OnInit, AfterViewInit {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ngOnDestroy(): void {
 | 
				
			||||||
 | 
					    window.removeEventListener('scroll', this.onDocScroll);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  onDocScroll() {
 | 
				
			||||||
 | 
					    this.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  anchorLinkClick( event: any ) {
 | 
					  anchorLinkClick( event: any ) {
 | 
				
			||||||
    let targetId = "";
 | 
					    let targetId = "";
 | 
				
			||||||
    if( event.target.nodeName === "A" ) {
 | 
					    if( event.target.nodeName === "A" ) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user