Interaction for nav menu

Hi everyone! I am new to webflow and trying to make my nav menu close automatically after clicking on one of the pages. I initially found some code to fix it but its making the nav bar glitch and sort of jump to the right and only returns to center when you refresh the page so I want to remove that code and create an interaction instead but im very confused as to how to do it! Do i have to make an interaction for the nav menu/bar on every page?? Pleaseeeee help!