我是否可以识别调整大小的 div 已溢出并将不再可见的内容放置在 DOM 或 JS 变量中的其他位置?

问题描述

我的目标是拥有一种导航栏/按钮组,当页面缩小/窗口大小由用户更改时,这些项目将一个一个折叠。

<div max-height="30px" width="100%" overflow="hidden">
   <button height="30px" width="30px">Button1</button>
   <button height="30px" width="30px">Button2</button>
   <button height="30px" width="30px">Button3</button>
</div>

假设窗口的宽度小于 90px,所以我的 3 个按钮将不再适合提供的 div。我是否可以在 JavaScript 中侦听此内容并保存会溢出且不会显示的整个元素(在本例中为 <button height="30px" width="30px">Button3</button>)以显示在警报或某种其他输出中?然后当 Button2 和 Button1 空间太小时。我无法在此项目中使用 JQuery,并且我不想滚动或使用其他方式使项目可见。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)