<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web 3.0, 6 Bladed Razors, 7 Minute Abs &#187; Scrolling</title>
	<atom:link href="http://www.zachleat.com/web/tag/scrolling/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 17:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Trash that &#8220;Back to Top&#8221; Link</title>
		<link>http://www.zachleat.com/web/trash-that-back-to-top-link/</link>
		<comments>http://www.zachleat.com/web/trash-that-back-to-top-link/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 01:30:30 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Interface Design]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Page Fold]]></category>
		<category><![CDATA[Scrolling]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=376</guid>
		<description><![CDATA[It would seem that perfection is attained not when no more can be added, but when no more can be removed. - Antoine de Saint Exupéry While most would argue that the principles espoused in the above quote might also be applied to the quote itself, it would serve us better to consider how we [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>It would seem that perfection is attained not when no more can be added, but when no more can be removed.</p>
<div style="text-align: right;">- Antoine de Saint Exupéry</div>
</blockquote>
<p><br/><br />
While most would argue that the principles espoused in the above quote might also be applied to the quote itself, it would serve us better to consider how we can <strong>attempt perfection in our User Interface designs</strong> instead.</p>
<p>The most complete litany of reasons why you should spend your page weight on more useful bytes has been <a href="http://www.cs.tut.fi/~jkorpela/www/totop.html">compiled by Jukka Korpela</a>, although he seems to both confirm that they are harmful and still use them on his site.</p>
<p>The rules of engagement I find useful when dealing with the ill-fated &#8220;Back to Top&#8221; or its ugly stepsister &#8220;Top of Page&#8221; link are as follows:</p>
<ol>
<li><strong>Delete the link.</strong></li>
</ol>
<p>Really, you don&#8217;t need the link. It&#8217;s a <strong>sacred cow remnant</strong> of a time when people believed that all content needed to be positioned <a href="http://iampaddy.com/lifebelow600/">above the page fold</a>.</p>
<p>Guess what?  <strong>People know how to scroll!</strong>  They know how to scroll down, they know how to scroll up.  Considering this prerequisite has been met, it becomes very apparent that the &#8220;Back to Top&#8221; link shares an <strong>unnecessary overlap in functionality with the scrollbar</strong> and is thus, unnecessary itself.</p>
<p>If you have an incredibly long page with a full set of &#8220;Table of Contents&#8221; links, it would be better to position your <a href="http://jqueryfordesigners.com/fixed-floating-elements/">table of contents fixed to the viewport</a>, so as to make it always available to the user.  If the Table of Contents is always available, the user will never have to click a link as a shortcut to find it.</p>
<p>While not a usability epidemic, the &#8220;Back to Top&#8221; link is still widely used.  <a href="http://www.instantshift.com/2009/07/14/90-creative-back-to-top-links-and-best-practices/">Instant Shift</a> and <a href="http://www.smashingmagazine.com/2008/11/27/short-story-about-top-links/">Smashing Magazine</a> both have articles with hundreds of examples of sites with these links.</p>
<p>Don&#8217;t agree? If you&#8217;re stubborn as hell and hate simplicity, you&#8217;re going to keep the link on your page no matter what reasons are presented.  In that case, at the very least follow these two guidelines:</p>
<ol>
<li>Use <strong>progressive enhancement</strong>:

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;back-to-top&quot;</span>&gt;</span>Back to Top<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// jQuery Prerequisite</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#back-to-top'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    window.<span style="color: #660066;">scrollTo</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// don't change the hash if not needed</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li><strong>Hide the link</strong> if the page doesn&#8217;t have a scrollbar.  If no scrollbar exists, the user will <strong>always be &#8220;at the top.&#8221;</strong>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Continuing with Previous Example</span>
$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#back-to-top'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// If the page scrolls, we know there is a scrollbar.</span>
$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#back-to-top'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// For completeness, you may also want to</span>
<span style="color: #006600; font-style: italic;">//   add logic to the &quot;resize&quot; event.</span></pre></div></div>

</li>
</ol>
<p>Really though, <strong>just delete the link.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/trash-that-back-to-top-link/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

