Both Liberty Hawk and Wikit use an animated scroll to top button with JQuery for xs and small views. The purpose of this feature is to ease navigation for users on small devices. Both apps have long-scrolling pages, and the scroll to top button makes getting back to the top of the page much easier than manually scrolling it. The implementation of this feature is practically identical between Liberty Hawk and Wikit (the difference being some style elements), so the discussion and code snippets below will just draw from Liberty Hawk.
Button - Display
The button element is placed under the footer. Its position is fixed in the lower right-hand corner of the view.
JQuery - smooth scroll
The second function returns the user to the top of the page, by triggering a click event handler on the page-scroll button. The click event uses the JQuery animate method to gradually change the state of the body element. The speed paramter is set to 800. The scrollTop property is used with a value of 0 to return the user to the top of the page without a vertical scrollbar.
JQuery - Easing
Several easing options were tried with animate, including linear. The JQuery easing plugin for Rails was also installed, but animate with a slow speed and the default swing function seemed sufficient for achieving the desired effect.