Detect DOM element resizing based on Vue3.x

Overview

vue-resize-next

Detect DOM element resizing based on Vue3.x


Installation

npm install --save vue-resize-next

with yarn 

npm install --save vue-resize-next

Then import the package and install it into Vue:

import VueResize from 'vue-resize-next'
app.use(VueResize)
// or in a component
// components: { VueResize }

Usage

Add the <vue-resize> inside a DOM element and make its position to something other than 'static' (for example 'relative'), so that the observer can fill it.

Listen to the notify event that is fired when the above DOM element is resized.

Example

<template>
  <div class="demo">
    <h1>Hello world!</h1>
    <vue-resize @notify="handleResize" />
  </div>
</template>

<script>
export default {
  methods: {
    handleResize ({ width, height }) {
      console.log('resized', width, height)
    }
  }
}
</script>

<style scoped>
.demo {
  position: relative;
}
</style>

You might also like...
A vue3 directive which automatically resize font size based on element width.
A vue3 directive which automatically resize font size based on element width.

Vue3 Resize Text A vue3 directive which automatically resize font size based on element width. It makes the font-size flexible on fluid or responsive

A Vue.js 2 component to clone DOM elements

vue-cloneya A vue component to clone DOM elements Live demo here Install yarn add vue-cloneya # or npm i vue-cloneya Import import Vue from 'vue'

An escape hatch for DOM Elements in Vue.js components.

vue-dom-portal An escape hatch for DOM Elements in Vue.js components. The directive v-dom-portal will move DOM Nodes from their current place in a Vue

A vue directive to keep dom ratio

vue-keep-ratio [中文项目介绍] As there comes a new css attribute: aspect-ratio, I picked up my old work vue-keep-ratio, use a more adaptive (but hack) way t

A directive-supported plugin for transfering DOM to another location in Vue.js components

A directive-supported plugin for transfering DOM to another location in Vue.js components

BEM is a great way to namespace DOM elements

Vue BEM Plugin BEM is a great way to namespace DOM elements. If you're like me, however, you can't stand manually writing __ and -- over and over agai

Cron Generator Implemented by Vue.js and Element-ui(基于Vue&Element-UI构建的在线Cron表达式生成器)

vue-cron-generator a project using vue,element-ui to generate cron expression 中文 Online demo Used by 👉 Attemper: A distributed,multi-tenancy,job-flow

实现最简 vue3 模型( Help you learn more efficiently vue3 source code )
实现最简 vue3 模型( Help you learn more efficiently vue3 source code )

CN / EN mini-vue 实现最简 vue3 模型,用于深入学习 vue3 Usage B 站 提供了视频讲解使用方式 想看更多关于 mini-vue 的课程可以加我 vx 哦 加我的公众号:阿崔cxr 公众号回复关键字:vx Why 当我们需要深入学习 vue3 时,我们就需要看源码来学习

A vue directive which automatically resize font size based on element width.
A vue directive which automatically resize font size based on element width.

Vue Resize Text A vue directive which automatically resize font size based on element width. It makes the font-size flexible on fluid or responsive la

Owner
null
Render children into a DOM node that exists outside the DOM hierarchy of the parent component

Portals provide a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component.

Nourse 0 Nov 8, 2018
Simple Plugin for URL Bar Resizing on mobile devices.

This Plugin solves the URL Bar Resizing issue with viewport units on mobile devices. Read here. Navigation Navigation Installation Registration Vue.js

Özkan Yanikbas 0 Apr 23, 2021
Detect when an element is becoming visible or hidden on the page.

vue-observe-visibility Detect when an element is becoming visible or hidden on the page. Demo Sponsors Table of contents Installation Usage Example In

Terminalqo 0 Oct 27, 2020
Vue component to trap the focus within a DOM element

focus-trap-vue Vue component to trap the focus within a DOM element Installation For Vue 2 npm install focus-trap focus-trap-vue For Vue 3 npm install

Eduardo San Martin Morote 169 Jan 1, 2023
Enable tap, swipe, touch, hold, mouse down, mouse up events on any HTML DOM Element in vue.js 3.x.

vue3-touch-events Enable tap, swipe, touch, hold, mouse down, mouse up events on any HTML DOM Element in vue.js 3.x. The easiest way to make your inte

Robin Rodricks 108 Dec 27, 2022
Convert HTML DOM Element to PDF

Convert HTML DOM Element to PDF. You can save a specified element as PDF File, print it directly, or preview as PDF.

Emily Wang 0 Jul 29, 2019
:electric_plug: Simple VueJS component to detect offline & online changes.

V-Offline ⚡ Detect offline & online events for your vue app. This is on GitHub so let me know if I've b0rked it somewhere, give me a star ⭐ if you lik

Vinayak Kulkarni 356 Dec 23, 2022
Vue.js 2.0 directive to detect images loading

Vue.ImagesLoaded A Vue.js 2.0 directive to detect when images have been loaded, based on imagesLoaded This directive allows to get a callback when chi

David Desmaisons 145 Nov 16, 2022
Vue directive to detect resize events with deboucing and throttling capacity.

Vue.resize Vue directive to detect HTML resize events based on CSS Element Queries with debouncing and throttling capacity. Demo Typical usage Simple

Pixel Lab 0 Oct 28, 2021
A Vue.js plugin that affixes an element on the window while scrolling based on a relative element

Affixes an element on the screen based on a relative element Unlike other plugins, this Vue 2 component will make it easy to affix any element while s

Mauricio Farias Dziedzinski 403 Dec 2, 2022