Scroll To javascript function in Mendix Client 6 Javascript API

0
Hi all, I want to add some custom scrolling in a widget, but the normal Javascript way of doing this, window.scrollTo, is not working. Also, the dojo fx scroll library is not by default implemented. What is the best function I can use in my custom widget for this? Preferably the one Mendix uses as well. Regards, Ivo
asked
2 answers
0

Look at my widget:https://github.com/simo101/ScrollToAnchor. You probably aren't scrolling the right region or the anchor hasn't loaded yet.

answered
0

In JavaScript, you can use

document.getElementById('id_of_object').scrollIntoView();

to get a specific element scrolled into view. Unfortunately it is not a smooth scroll, that can only be done when using Firefox or using a library like jQuery.

Instead of getElementById(), you probably know a way to find your object using your widget.

answered