Mendix brings content in using JavaScript, so your $(document).ready will only run once, as the ready event is only triggered once when the app first loads, not when content changes.
You need to look at the ScrollToAnchor widget as already suggested by Ronald Catersels. This can listen to various Mendix events such as on load, on change of an object, on an attribute change, on validation, or on all of the previous, and then trigger a scroll when they occur.
Download and documentation links below.
https://appstore.home.mendix.com/link/app/2583/
https://github.com/simo101/ScrollToAnchor