当前位置:网站首页>Monitor the width and height of the parent element, adapt to the size of the plug-in
Monitor the width and height of the parent element, adapt to the size of the plug-in
2022-08-01 07:03:00 【The original was _】
Reference Documentation: ResizeObserver
Usually used for third-party plugins to adapt to width and height: echarts/antv, etc.
//Monitor object change callbackconst resizeObserver = new ResizeObserver(entries => {for (let entry of entries) {if(entry.contentBoxSize) {const width = document.getElementById('fatherbox')span>.clientWidthconst height = document.getElementById('fatherbox')span>.clientHeightdocument.getElementById('sonbox').style.span>width = width}}});//Initialize the registered listener objectconst init = () => {resizeObserver.observe(document.getElementById('fatherbox'));}
边栏推荐
猜你喜欢
随机推荐
升级为重量级锁,锁重入会导致锁释放?
return; represents meaning
flinkcdc对mysql的date字段类型转化有什么解决思路么
MATLAB程序设计与应用 2.5 MATLAB运算
Practical training Navicat Chinese and English mode switching
Windows taskbar icon abnormal solution
Golang:go开启web服务
Dialogue with the father of MySQL: One excellent programmer is worth 5 ordinary programmers
第02章 MySQL的数据目录【1.MySQL架构篇】【MySQL高级】
uva12326
目标检测概述-上篇
数据机构----线性表之单向链表
Guest brush SQL - 2
matlab simulink 粒子群优化模糊pid控制的电机泵
LeetCode每日一题(309. Best Time to Buy and Sell Stock with Cooldown)
从离线到实时对客,湖仓一体释放全量数据价值
Golang: go to connect and use mysql
权重等比分配
从底层结构开始学习FPGA(6)----分布式RAM(DRAM,Distributed RAM)
问下 mysql向pg同步多个表的话 有什么好的方案吗?