I am trying to make a simple scroll down happen when the page is loaded.
@Route("somthing")
public class SomeView extends VerticalLayout{
public SomeView(){
...
Adding some Elements
...
UI.getCurrent().getPage().executeJs("window.scroll(0,300)");
}
}
I also tried adding a listener to the window:
UI.getCurrent().getPage().executeJs("window.addEventListener('onload', function(){console.log('trigger');window.scroll(0,300);});");
But in both cases simply nothing happens when the page is loaded.