I is it possible to auto move webpage horizontal scrollbar?

I have a web page that has lots of item in it and can scroll horizontally. Is there a way to programmatically move horizontal scroll bar to the right most of the webpage?

You could move the whole window, for instance, that might be the best approach, in this case.

Click on the button leads to:

Code in the button’s pressed event:

me.ExecuteJavaScript("window.scrollTo({ top: 0, left: 2500, behavior: 'smooth' });")

Not sure though, if it is smart doing this. All users have different approaches, different window sizes, different behaviors, different expectations. Ask yourself the question: how often have you seen a button, scrolling a webpage to horizontally to a different position? ;-). I’m not saying that it is wrong, but you should always ask yourself such questions, and/or if it might be better to design your webpage in a different way.

2 Likes

This things work!

How I wish it will have a xojo command to do the same things.
Thank you Mr. Muller!

1 Like

You can see it “differently” too :wink: : at least it is possible. One major challenge is, that the possibilities in CSS are almost endless. It would probably not make sense to integrate them all. Now I do agree, that it would be very nice to have more options with Xojo Code, but it will be hard for Xojo to decide, what is needed by - let’s say - the majority of users.

Agree.

The reason why I dive to xojo because it helps to relieved from difficulties on understanding css/javascript.

If xojo will require me to understand it more, it might push me to learn php or java and left xojo. in the future.