7 examples of 'viewport height' in JavaScript

Every line of 'viewport height' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
29async setViewportHeight(height: number) {
30 this.frame.setViewport({ ...this.initialViewport, height })
31}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

40get height() {
41 return this._dom.clientHeight;
42}
55get displayHeight() {
56 return this.template.height || 768;
57}
56get contentHeight(): number {
57 return this.contentWrapperElement.clientHeight;
58}
59export function viewportHeight(){
60 return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
61}
160private _getScreenHeight(): number {
161 let screenHeight;
162
163 if (this._useWindowAsScreen) {
164 // clientHeight仅仅包括可视范围的高,不包括已经被scroll到上面或者下面的高
165 screenHeight = this._windowRef.document.documentElement.clientHeight;
166 } else {
167 screenHeight = this._screenRef.clientHeight;
168 }
169
170 return Math.ceil(screenHeight);
171}
43set height(height: number) {
44 this._dom.height = height;
45}

Related snippets