Scroll on mobile

i want to scroll the menu in mobile with touch and not without the button or the scroll bar how can i do that this is my project

1 Like

Not sure what do you mean by “not without the button” ?

cc @DarraghBurke

1 Like

i want to scroll my cotent on mobile by touching i dont want to scroll by touching the scroll bar

1 Like

Hello, do you have a solution?

I could really use it right now.

@Y.R.R I am not familiar with the Babylon GUI but from what I see it looks like you need to attach your own event listener on the box (if that’s even possible) and when you detect mobile device and scroll (not just tap, long lasting event with changing the coordinates) you need to scroll by yourself (run Babylon scroll if that’s possible or do it somehow by yourself).
I don’t know what project you’re building but I’m doing similar things in my project and I’m not using Babylon GUI - I’m using native HTML (because I believe that it’s very hard to mimic the native HTML behaviour and it doesn’t make sense)

I only use Babylon for development, I have some difficulty in the scroll bar, because I don’t know how to get the scroll area, my scroll area is just written in the pop-up window.

Can I know how you get the box for the scroll area?

It would be easier if you could share some code because I’m not sure if I understand your problem.

As I said I use native HTML and not Babylon GUI components so I don’t need to get the scroll area.
It’s just a HTML Div element with CSS properties that make the scroll behaviour works as expected natively.

One thing to point out is that you assumed some behaviour on mobile based on your experiences - I assume :slight_smile: and now you expect the Babylon GUI to work like the native HTML elements in the browser - that the scroll will work on mobile for Babylon GUI box when you’re scrolling with your one finger.

1 Like

Thank you. I wrote it out just now, but it was a bit stupid because I didn’t know how to get the scroll area, so I listened to the canvas, and when I swipe, I move the scroll bar down.

document.body.addEventListener(“touchmove”, function (e) {

// e.preventDefault();

Console. log(’ slipped ');

Sv. VerticalBar. Value + = 0.01;

});

Okey @Y.R.R, so is it working for you now?

I missed that this post was originally added by @Ashish_Abhiwan

Now it works, and it works very well. My next job is to listen on the scroll area, not on the canvas.

@Y.R.R I don’t know Babylon GUI so I don’t know if that’s even possible because it’s all painted in the canvas element.
But good luck :slight_smile:
Have you considered using HTML elements instead? Looks like they have everything you need