#Disabling transition on load?

2 messages · Page 1 of 1 (latest)

proper fiber
#

I have a sticky navbar lower in the page which uses an intersection observer to transition to another color when it reaches the top. But the problem is that there's a transition on page load, is there a smart SolidJS way to fix it?

#
  let container: any;
  const visible = createVisibilityObserver()(() => container);
  const stuck = () => !visible();

  return (
    <>
      <div ref={container} />
      <nav
        class={
          "sticky top-0 flex w-full items-center justify-between px-7 py-3 font-display font-bold"
        }
        classList={{
          [stuck()
            ? "bg-secondary text-primary-light transition duration-1000 ease-out"
            : "bg-beige transition duration-1000 ease-out"]: true,
        }}
        id="navbar"
      >
        navbar content
</nav>
</>
)