2339
Views
15
Comments
jQuery ScrollTo not working
Question

Good afternoon, 

I'm trying to use the jQuery function ScrollTo in order to Scroll 100px down on one of my pages of a mobile application created using the P10, but it's not working. I tried to run the function window.ScrollTo(0,100) using the console of the browser but the page didn't move. In order to check if the function was being correctly used, I ran the same expression using the console but on a different page, and nothing happened. 

Does somebody know, how to perform a scroll using jQuery or JavaScript on a mobile app? 

Thank you,

João Santos

UserImage.jpg
Jovvy

When you tried to test the ScrollTo function in the console did you get an error?

2024-04-12 15-17-49
João Miguel Santos

No, it returns "undefined", but nothing happens.

UserImage.jpg
Jovvy

Can you print screen the console when you ran the function.

2024-04-12 15-17-49
João Miguel Santos

So, this is the return of trying to scroll 100px and the test of the scrollTo function.

UserImage.jpg
Jovvy

Try to type ScrollTo) with close & open parenthesis instead of just ScrollTo.

2024-04-12 15-17-49
João Miguel Santos

That returns the error you can see above.

UserImage.jpg
Jovvy

I'm expecting that error. Anyway, do you mind copy & paste the codes of scrollTo function.

2024-04-12 15-17-49
João Miguel Santos

How so? I didn't understand what do you want me to copy and paste.

UserImage.jpg
Jovvy

Ah yeah, scrollTo is not a jquery function its a built in browser's function.


Try the scrollTop function of jquery. See more here https://api.jquery.com/scrollTop/

2024-04-12 15-17-49
João Miguel Santos

This is the series of commands I just executed. If I apply scrollTop without referring an object or class, the console returns an error. If I execute scrollTop(100), the console top returns that information but nothing happens. I applied the last command $(".content").scrollTop(100) to another page and it worked. This last page wasn't build using Outsystems, as far as I know.

UserImage.jpg
Jovvy

You always need to use "$" dollar sign symbol to invoke a jquery function.


Try to use $(document).scrollTop (your desired value) and let me know how it goes.

2024-04-12 15-17-49
João Miguel Santos

I applied those two commands but nothing happened.

2017-06-04 18-13-04
Mariela Mayorga

Hi Joao, Did you solved this? I have the same issue.

2016-04-21 20-09-55
J.
 
MVP

Hi mariela,

Scrollto will work, but you have to take into account the whole page and their overflows in containers.

If the html got a container which will handle the overflow you can scrollto the documen as much as you like but there will be no effect.


That said, what is your issue exactly? Could you share an oml where it is happening?


2017-06-04 18-13-04
Mariela Mayorga

Hi. Yes, maybe that's what is happening. As soon as I can, I'll try to upload a small oml with the behaviour I'm  getting.

Thanks.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.