Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
css
dist
images
js
.babelrc
.gitignore
3-dev-adam-poster.css
README.md
console-test.html
example-basic-no-fix.html
example-basic.html
example.html
iframe-test.html
iframe.html
package.json

README.md

text-zoom-resize

A library that will detect when a user zooms text in their browser. This is a common use case for people who are visually impaired.

Usage:

Initialize using textZoomEvent.init():

// It is better if you give this the value of 
// parseFloat(getComputedStyle(document.documentElement).fontSize
// when the doc is not zoomed.
textZoomEvent.init(16);

You can find the current zoom factor using textZoomEvent.resizeFactor():

console.log('on load, resize factor is ', textZoomEvent.resizeFactor());

You can also use the textzoom event to fire when the user zooms the text with their browser:

document.addEventListener('textzoom', function (e) {
    console.log('ds', textZoomEvent.unzoomPixelValue, e.detail.resizeFactor());
});

How can you test? Different browsers have different UIs for zooming text. Full details can be found on my blog post about this library at https://www.useragentman.com/blog/?p=7749

You can’t perform that action at this time.