You can find my project here: https://codesandbox.io/s/franchise-bg-effect-obd55
I am trying to match an array of CSS background ID tags (
bgArr) to an array of each section (
afterLoad(). So section 1 should have the ID of ‘red’, section 2 ID of ‘blue’, and section 3 ID of ‘green’. On page load, section 1 has the correct ID tag of ‘red’. When scrolling to section 2, in the console you will notice that
bgIndex updates to the correct ID tag of ‘blue’ but the ID of the div on the page remains red. I’m not sure how to re-render the div with the updated ID tag.