Forum Academy Marketplace Showcase Pricing Features

Highlight a link based on the scrolling position (relative to a specific element)

Hi guys,

Do you know how I could highlight a link or a text based on the scrolling position (relative to a specific element)

Ex on the following image, I would like the links on the left to highlight when the scrolling position is the referred element on the right.

Thanks for helping :slight_smile:

@JBG The two elements on the left are fixed and the element on the right is a vertical scroll repeating group, correct? If so, it sounds like you need to get the scroll position of the RG on the right. I’m not sure if that can be done without a plugin. There are plugins to do this but I’m not sure if any of them are free. Here’s one you can take a look at:

If by chance the entire page is scrolling (for example if the elements on the left are floating and the user scrolls the entire page to view the list on the right) then you can simply set a conditional on the text you want highlighted based on the page’s scroll position.

@AlexE Exactly, the left group is inside a floating group. However, the right group is not a RG but just handwritten groups.

Unfortunately, I don’t know how to set the conditional formatting…

The current page scroll position is a pixel number - so just work out the min and max pixel range for each text group

1 Like

@JBG you’ll need to put a numeric value in there For example:

Current page scrolling position > 100 and Current page scroll position < 400

The above expression would allow you to modify text when the page scroll position is between 100 and 400. You can use the console in the browser’s devtools to get the scroll position by using “window.pageYOffset”. Let me know if you need help with that.

1 Like

@AlexE @equibodyapp Your idea seem pretty good, but unfortunately it doesn’t work that much in this case…

  1. Texts length will be variable based on the language (FR > EN text)
  2. Scrolling text could depend on page width.

Are you sure there is no way to be based the scrolling position on elements ? :confused:

@JBG not that I know of but I’ll let you know if I think of anything. If you can’t find a way to make this work the best solution may be to use a RG on the right side of the page and then use the RG’s active cell index to reference in the conditional statement of the text on the left hand side.

You might have to look at a plugin

This topic was automatically closed after 70 days. New replies are no longer allowed.