mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-11-04 01:37:32 +03:00 
			
		
		
		
	Fix sticky sidebar (#75)
This commit is contained in:
		
							parent
							
								
									2bc729ea23
								
							
						
					
					
						commit
						a01f9f41a4
					
				| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
<div class="methods">
 | 
					<div class="methods">
 | 
				
			||||||
  <div class="tag" *ngFor="let tag of tags;trackBy:trackByTagName">
 | 
					  <div class="tag" *ngFor="let tag of tags;trackBy:trackByTagName">
 | 
				
			||||||
    <div class="tag-info" [attr.section]="tag.id" *ngIf="!tag.virtual">
 | 
					    <div class="tag-info" [attr.section]="tag.id" *ngIf="!tag.headless">
 | 
				
			||||||
      <h1 class="sharable-header"> <a class="share-link" href="#tag/{{tag.name | encodeURIComponent}}"></a>{{tag.name}} </h1>
 | 
					      <h1 class="sharable-header"> <a class="share-link" href="#tag/{{tag.name | encodeURIComponent}}"></a>{{tag.name}} </h1>
 | 
				
			||||||
      <p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p>
 | 
					      <p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,6 @@ export class StickySidebar implements OnInit, OnDestroy {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bind() {
 | 
					  bind() {
 | 
				
			||||||
    this.cancelScrollBinding = DOM.onAndCancel(this.scrollParent, 'scroll', () => { this.updatePosition(); });
 | 
					    this.cancelScrollBinding = DOM.onAndCancel(this.scrollParent, 'scroll', () => { this.updatePosition(); });
 | 
				
			||||||
    this.updatePosition();
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  unbind() {
 | 
					  unbind() {
 | 
				
			||||||
| 
						 | 
					@ -56,8 +55,9 @@ export class StickySidebar implements OnInit, OnDestroy {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit() {
 | 
					  ngOnInit() {
 | 
				
			||||||
    // FIXME use more reliable code
 | 
					    // FIXME use more reliable code
 | 
				
			||||||
    this.$redocEl = this.$element.offsetParent || DOM.defaultDoc().body;
 | 
					    this.$redocEl = this.$element.offsetParent.parentNode || DOM.defaultDoc().body;
 | 
				
			||||||
    this.bind();
 | 
					    this.bind();
 | 
				
			||||||
 | 
					    this.updatePosition();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnDestroy() {
 | 
					  ngOnDestroy() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user