Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DonnieBerryDev opened this issue May 12, 2023 · 1 comment

Comments

@DonnieBerryDev
Copy link

DonnieBerryDev commented May 12, 2023

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?

@rikschennink
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants