| 1234567891011121314151617181920212223242526272829303132 |
- export class height_equaler {
- #to;
- #from;
- constructor(from, to) {
- this.#from = from;
- this.#to = to;
- this.#set_styles();
-
- new ResizeObserver(() => {
- this.#update();
- }).observe(from);
- setTimeout(() => {
- this.#update();
- }, 100);
- }
- get height() {
- return this.#from.offsetHeight;
- }
- #set_styles() {
- this.#to.style.height = "0px";
- this.#to.style.transition = "height 0.5s";
- }
- #update() {
- this.#to.style.height = this.height + "px";
- }
- }
|