Element on Every Page, target with masterPage.js?

I’m having some issues figuring out the proper way to do this in Wix Studio.

What is the expected way to add elements like a side navigation panel to every page?

I had success with headers, for creating a smaller header bar when scrolling, but I tried the same method for a side nav bar, and it was really buggy and wouldn’t let me pin the element. I found I could save the nav panel as an asset to carry over to other pages though.

But, in some instances the layout design is altered or destroyed from it’s saved state when added it to a new page.

In other instances, the javascript that was working on the masterPage.js, stops working. Even though the elements are there on the page with the right id. It now shows errors that the element isn’t there…

Seems like I have to paste the javascript in on each page… which kind of doesn’t make sense to me.

So, I’m just trying to wrap my head around what the expected workflow is.
Right now, it kind of goes against the things I know, and it is a frustrating. So, I think I just need to understand what the system is expecting. Anyone have any insight?

What method did you employ?

Think you also need to show us what the errors are and maybe some screenshots…