Panel "In Viewport" triggering multiple times, should only trigger once

I’m trying to use the BricksForge panel to click a “Load More” button when the button enters the viewport.

The problem that I’m having is the “In Viewport” event triggers multiple times instead of just once when it enters the viewport. See the attached video. Also, since recording the video I made the selector more specific “#brxe-loxcen .jet-filters-pagination__link” and still have the same issue.

This editor won’t let me paste a link to the recorded video :frowning:

Hello Alan! That’s actually the expected behavior for “In Viewport” - it means that the action will be triggered while the element is in view. You may need to use another event called “Comes to Viewport” for your specific needs, which I could consider adding to the next versions. As a temporary workaround, you can add a class to the body when the element is in view and only trigger your action if the body doesn’t have this class. Once the element is no longer in view, you can remove the class from the body. Hope that helps :slight_smile:

Ah OK,
I resolved it with a simple IntersectionObserver instead.

1 Like