Narcissistic Preening Monarch

    element-resize-event-polyfill

    1.0.5 • Public • Published

    element-resize-event-polyfill

    Native event listener polyfill to capture element size changes

    Install

    npm install element-resize-event-polyfill --save-dev

    Usage

    Example in es6

    import 'element-resize-event-polyfill'
     
    const elm = document.getElementById('#elm')
     
    elm.addEventListener('resize', handler)

    Example in Browser

     
    <head>
      <script src="element-resize-event-polyfill.umd.min.js"></script>
    </head>
     
    <body>
      <div id="elm">My size can be captured</div>
    </body>
     
    <script>
      const elm=document.getElementById("elm")
      
      // case one
      elm.addEventListener("resize",function(e){
        // Your logic
      })
     
      // case two
      elm.onresize=function(e){
        // Your logic
      }
    </script>
     
     

    Example in vue

     
    <template>
      <div v-on:resize="handlerResize"></div>
    </template>
     
    <script>
    export default {
      methods:{
        handlerResize(e){
          // Your code
        }
      }
    }
    </script>

    Install

    npm i element-resize-event-polyfill

    DownloadsWeekly Downloads

    15

    Version

    1.0.5

    License

    ISC

    Unpacked Size

    260 kB

    Total Files

    15

    Last publish

    Collaborators

    • konglingwen