Resize docs code templates on open (mobile)

This commit is contained in:
hunicus
2022-03-12 15:59:59 -05:00
parent 838725a862
commit 4c8ac3a585
3 changed files with 30 additions and 23 deletions

View File

@@ -79,27 +79,23 @@ export class ApiDocsComponent implements OnInit {
}
openEndpointContainer( targetId ) {
if( window.innerWidth > 992 ) {
return;
}
const endpointContainerEl = document.querySelector<HTMLElement>( "#" + targetId );
const endpointContentEl = document.querySelector<HTMLElement>( "#" + targetId + " .endpoint-content" );
const endPointContentElHeight = endpointContentEl.clientHeight;
if( window.innerWidth <= 992 ) {
const endpointContainerEl = document.querySelector<HTMLElement>( "#" + targetId );
const endpointContentEl = document.querySelector<HTMLElement>( "#" + targetId + " .endpoint-content" );
const endPointContentElHeight = endpointContentEl.clientHeight;
if( endpointContentEl.classList.contains( "open" ) ) {
endpointContainerEl.style.height = "auto";
endpointContentEl.style.top = "-10000px";
endpointContentEl.style.opacity = "0";
endpointContentEl.classList.remove( "open" );
} else {
endpointContainerEl.style.height = endPointContentElHeight + 90 + "px";
endpointContentEl.style.top = "90px";
endpointContentEl.style.opacity = "1";
endpointContentEl.classList.add( "open" );
}
if( endpointContentEl.classList.contains( "open" ) ) {
endpointContainerEl.style.height = "auto";
endpointContentEl.style.top = "-10000px";
endpointContentEl.style.opacity = "0";
endpointContentEl.classList.remove( "open" );
} else {
endpointContainerEl.style.height = endPointContentElHeight + 90 + "px";
endpointContentEl.style.top = "90px";
endpointContentEl.style.opacity = "1";
endpointContentEl.classList.add( "open" );
}
}
}
wrapUrl(network: string, code: any, websocket: boolean = false) {