Net Possibility Multiplier

    text-zoom-event

    1.5.2 • Public • Published

    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

    Install

    npm i text-zoom-event

    DownloadsWeekly Downloads

    28

    Version

    1.5.2

    License

    SEE LICENSE IN js/textZoomEvent.js

    Unpacked Size

    937 kB

    Total Files

    21

    Last publish

    Collaborators

    • zoltandulac