Scrolling a page from its bottom to a top is funny simple for achieving with the means given by MODx — you need to create anchor at the top and link it at the bottom (usually in footer section):
Simple "top of page" Link
<a name="topofpage"></a>
... main part of the page ...
<a href="[~[*id*]~]#topofpage">top of page</a>
The above code works fine for all typical cases but it is insufficient on sophisticated pages whose urls comprise one or more query variables — after clicking on such „top of page” link all query variables are lost and you are landing on the base/first page of the whole set of pages determined by those variables.
Scenario for generalized "top of page" Link
<a href="[(site_url)][!SelfReference!]#topofpage">top of page</a>
This generalized scenario works on this site, so I do not need to create special example in order to present how the snippet behaves ;) The snippet has been also posted to this thread on MODx forum.
The second attached version has been slightly modified — it still preserves all query variables of the currently active page, but allows you to specify &redir parameter and send a user to another page.




Comment #1 on: 2010-01-04, 16:05
Comment #2 on: 2011-05-24, 16:56