I’m trying to scroll to a specific section on the view to improve user experience on long pages. This would be especially useful on smaller devices, which normally have content laid out vertically instead of horizontally.
Here is what I have done:
- created a sample long scrollable view (added a few components, set basis to 1000px, set shrink to false)
- added a label on the very bottom of the view
- added meta property
domId
with a value oflabelBottom
to said label - added a button at the top of the view
- added onActionPerformed script with body
system.perspective.navigate('#labelBottom')
I’m not sure if system.perspective.navigate()
is the correct function to use here. I see that it appends #labelBottom
to the URL. However, nothing happens unless I refresh the page.
Workaround
What I can do is use a Perspective Link component and link to #labelBottom
, in which case it works as expected. However, I’d like to have the flexibility of using a button for that purpose.
PS
Also another question: when did domId
become available? My coworker and I were trying to do something similar a few months ago and we didn’t see it. I just happened to stumble upon it a few days ago messing around in the designer.
Thanks in advance.