Scroll to particular section in the page

1
Hi all, i want to scroll to particular section of the page on page load. i am using anchor widget and javascript to make it work. but it is working only the first time we open the page .can i get a consistent solution for this issue?   here is the javascript i am using: $(document).ready(function() { document.getElementsByClassName("moveTo")[0].scrollIntoView({behavior: "smooth",block: "start"}); }); -moveTo is the anchor class  
asked
1 answers
0

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

answered