Refresh to top of page

Hi All,

I have a web block (edit record widget) on a screen with a list records widget underneath. When you click on one of the list the web-block refreshes to show that list record. All is working well, but when I click on the list I would like the page to refresh to the top of the screen where the web block is.

I found this:

<a href="javascript:scroll(0,0)">

But it only seems to scroll to the top of the list widget as opposed to the top of the screen. Any ideas?


Simple HTML Anchors might be what you're looking for.

<a name="topOfPage"></a> (No content to keep it invisible, and placed at the top of the page or wherever you want to scroll to)
then a link <a href="#topOfPage">Top</a> wherever you need it.

You can easily implement this with expressions with Escape Content: No.

Best regards 
Thanks Antonio, will give it a go in the morning!
Hi Antonio,

Works great, but when I add the link HTML as onclick for an image it doesn't work, but works fine when it is just a link as part of an Expression. Any ideas?


Hello Tom,

try to add this in the image onclick property:

osjs('html, body').animate({scrollTop:0}, 'slow');

let us know how if this works.

Works perfectly! Thank you Miguel.
That's a nice thing to know Miguel :D
Specially cause it uses .animate, wich adds a touch of smoothness to it.

*Adds to Cheat Sheet*

Thank you :)

and I'm glad to know that it was useful!

But indeed, what a simple word can do, its the wonders of jQuery!