Skip to content

Disables zooming in browsers that do not support the viewport meta tag

Notifications You must be signed in to change notification settings

wjbryant/nozoom.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

nozoom.js

Disables zooming in browsers that do not support the viewport meta tag.

Requirements

  • CSS zoom must be supported by the browser for nozoom.js to prevent zooming. The interceptEvents option is automatically disabled if CSS zoom is not supported.
  • addEventListener
  • Object.defineProperty
  • Array.prototype.forEach
  • document.createEvent

Usage

nozoom.support

This is an object containing the following properties:

  • cssZoom - Indicates whether the browser supports CSS zoom.
  • cssZoomReset - Indicates whether the browser supports CSS zoom reset.

nozoom.useFullscreen

Set this to true to use properties based on the full screen size to calculate the zoom factor. The default value is false.

nozoom.getZoomFactor([useFullscreen])

Returns the current zoom factor. Pass a boolean value to override nozoom.useFullscreen.

nozoom.adjustCoords(x, y, [useFullscreen])

Returns an object with x and y properties that contain the adjusted x and y values for the current zoom factor. The third argument can be used to override nozoom.useFullscreen.

nozoom.init(opts)

Initialize nozoom with the following options:

  • useFullscreen: boolean - Sets nozoom.useFullscreen.

  • disableTextSelection: boolean - Whether to disable text selection and only allow scrollbars to scroll. This disables touch gestures in some browsers. The default value is false.

  • extendMouseEvent: boolean - Whether to extend mouse event objects to include additional coordinate properties that account for the zoom level. Ex: clientXZoom. The default value is false.

  • interceptEvents: boolean - Whether to intercept all mouse events and adjust coordinate values for the zoom factor. The default value is true.

About

Disables zooming in browsers that do not support the viewport meta tag

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published