Skip to content

saschanaz/fixedviewport.js

Repository files navigation

fixedviewport.js

A polyfill to implement fixed viewport for desktop browsers. See the demo here.

API

declare namespace FixedViewport {
  function hasNativeSupport(): boolean;
  function polyfill(width: number, height: number): void;
}

Example

FixedViewport.polyfill(1920, 1080);

Note

This polyfill mocks Internet Explorer's CSS Device Adaptation implementation. You MUST add proper CSS @viewport rule for your fixed viewport, as this polyfill will do nothing for the browsers which natively support the CSS Device Adaptation spec.

This is an example for 1920*1080 viewport.

@-ms-viewport {
  width: 1920px;
  height: 1080px;
}
@viewport {
  width: 1920px;
  height: 1080px;
}

Also note that IE11 and Edge on Windows 10 ended CSS Device Adaptation support since Anniversary Update so this library runs in polyfill mode in that case.

About

A polyfill to implement fixed viewport for desktop browsers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages