Scroller - multiple on same page - discrepancies

Hello, I have a few of the same Scrollers on the same page. I have changed id/class so they can be styled different. One is reversed and one is regular. Im on CodePen with boths codes in same workspace and still cant seem to find the discrepancy between these both. CAn someone please inspect this for me? that would be greatly appreciated! Only one scroller will work when both codes are together, Thanks - codes below:


  REMEMBERING OUR SISTERS  
![mmiw_icon_58dfa734-74ca-4836-9e51-1e61f9cf3cc0.png?v=1711062378|396x396](upload://lsHXazdq5BOVnTKLCShH1DWJVZm.png)

  BUY NOW, PAY LATER  
![white_sun.svg?v=1710724460|500x500](upload://hj6L7zVTGv3IfOlKhn0itQYCTtS.svg)

You can’t use const reverse = document.getElementById(…); twice.

Since it’s const it can not be modified and redeclared again.

So either use a different variable name, or use var instead of const.

Can you elaborate more please, thanks. I changed the const to var one one scoller and did nothing.

Hi @xnyjyh you can try this code. The variable reverse is already used in the first javascript code, so you can not use the same variable in the second code. Because on one page it will read as the same variable. So you have to use the different variables.


  REMEMBERING OUR SISTERS  
![mmiw_icon_58dfa734-74ca-4836-9e51-1e61f9cf3cc0.png?v=1711062378|396x396](upload://lsHXazdq5BOVnTKLCShH1DWJVZm.png)

  BUY NOW, PAY LATER  
![white_sun.svg?v=1710724460|500x500](upload://hj6L7zVTGv3IfOlKhn0itQYCTtS.svg)

1 Like

I understand this now. I have to change the text after const! It works, nice. Thank you Alyd-Expatify