Trigger hover event on page load?

Hello there! I’ve made a flexbox container that expands each item on hover. It does this not by using Interactions, but by switching the item’s flex child’s sizing property to “grow if possible” when you hover over the item.


Here’s the deal, I want the first item to already be expanded (as if hovered), when the page loads, so that the function of the item is obvious without having to say “hover over here” etc. If I was using interactions I could set the initial state of that first panel, but I’m not.

Using javascript or Jquery is there a way I can trigger a hover (“mouseover”?) event on page load that automatically expands the first item in the panel (“Gospel”)? I’ve given that first panel the id “hovered” and tried out some custom Jquery scripts around Google, but nothing’s worked.

Here’s an example of a hover event triggering on page load and hover: Edit fiddle - JSFiddle - Code Playground

Thanks a lot.

Read only: https://preview.webflow.com/preview/reach-kirkland?utm_source=reach-kirkland&preview=5c7f1188a5efb542a8f6bd96d8b34b8f

Live: https://reach-kirkland.webflow.io/who-we-are

Hi Stephen,
Can I ask why do you have to use the flex child’s sizing property to resize on hover?
(The combination of the interaction and the css transition is also what makes the jittery and un-smooth motion of the tiles)

I went that route because I followed a tutorial by WebDevforYou to create this element. I did notice the bit of jitter, so maybe I will try rebuilding with Interactions.

1 Like