Skip to content

xelaok/svelte-watch-resize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svelte-watch-resize (npm, demo)

Watch element resize in Svelte

Installation

npm i -S svelte-watch-resize

Usage

<script>
    import { watchResize } from "svelte-watch-resize";

    let leftWidth;
    let mainWidth;

    function handleLeftResize(node) {
        leftWidth = node.clientWidth;
    }

    function handleMainResize(node) {
        mainWidth = node.clientWidth;
    }
</script>

<div class="root">
    <div class="content leftContent" use:watchResize={handleLeftResize}>
        {leftWidth}
    </div>
    <div class="content mainContent" use:watchResize={handleMainResize}>
        {mainWidth}
    </div>
</div>

About

Watch element resize in Svelte

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published