fitty icon indicating copy to clipboard operation
fitty copied to clipboard

Sometimes, it doesn't fit on load. Forced to manually shrink window to re-fit it.

Open DonnieBerryDev opened this issue 2 years ago • 3 comments

My code is extremely simple for my use case.

JS

import fitty from "fitty";
export default class Fitty {
  constructor() {
    this.init();
  }

  init() {
    fitty(".fitty");
  }
}

HTML

<div class="hero__inner">
            <div class="text">
                <h1 class="heading--1 fitty">COMPANY NAME</h1>
            </div>
</div>

Sometimes, it works on load and fits. Although sometimes, I refresh the page and the text is extremely small. But, if I resize the viewport even by a pixel, it will automatically snap and fill the width of the container. Where am I going wrong?

DonnieBerryDev avatar May 12 '23 23:05 DonnieBerryDev

Only thing I can think of is that the scripts maybe loads before the CSS loads or after causing a difference in how it runs.

rikschennink avatar May 13 '23 06:05 rikschennink