Stop jumping to top of page when slide comes in

I have slides coming from the side when an element is clicked. It wasnt working well in mobile so after some searching i found out that setting the body to position fixed made it work. The problem I am having now is coming back from the slide makes the page jump to the top.

I think it takes custom code to fix with page offset but not sure. Any advice?