B4J Question [ABMaterial] Button click to scroll to top of page?

ToolboxZX

Member
Licensed User
Longtime User
Is there any way with a click event of a button to have ABMaterial scroll or go to the top of the page it creates?

I know how I would do this in a regular html document using an anchor reference, but was not sure how to do this exactly with abmaterial. Thanks.
 

PCastagnetti

Member
Licensed User
Longtime User
you can use
B4X:
Dim script As String = $"$("body").animate({ scrollTop: $('#mrow0cont').offset().top -100}, 1000);"$  ' <-- scroll animated to img.ID
        page.ws.Eval(script, Null)
        page.ws.Flush ' IMPORTAN

where '#mrow0cont' is the ID of the object to be reached (in your case the first on the top of the page)
 
Upvote 0

ToolboxZX

Member
Licensed User
Longtime User
you can use
B4X:
Dim script As String = $"$("body").animate({ scrollTop: $('#mrow0cont').offset().top -100}, 1000);"$  ' <-- scroll animated to img.ID
        page.ws.Eval(script, Null)
        page.ws.Flush ' IMPORTAN

where '#mrow0cont' is the ID of the object to be reached (in your case the first on the top of the page)
 
Upvote 0

ToolboxZX

Member
Licensed User
Longtime User
Is there a variation of this script that also works for IE? I noticed it works great in Edge but not in IE
 
Upvote 0

mindful

Active Member
Licensed User
Version 3.02 introduced new methods to help you with that:

[NEW] Scroll to a certain row, component or section
---------------------------------------------------
Three new page methods:

ScrollToRow(row as int, scrollTop as int, speed as int)
ScrollToComponent(component as ABMComponent, scrollTop as int, speed as int)
ScrollToSection(sectionID as String, scrollTop as int, speed as int)
 
Upvote 0
Top