src/cm/media/js/lib/yui/yui_3.10.3/docs/scrollview/scrollview-scroll.html
changeset 525 89ef5ed3c48b
equal deleted inserted replaced
524:322d0feea350 525:89ef5ed3c48b
       
     1 <!DOCTYPE html>
       
     2 <html lang="en">
       
     3 <head>
       
     4     <meta charset="utf-8">
       
     5     <title>Example: ScrollView with Scroll Indicator and Link Suppression Behavior</title>
       
     6     <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic">
       
     7     <link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css">
       
     8     <link rel="stylesheet" href="../assets/css/main.css">
       
     9     <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
       
    10     <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
       
    11     <script src="../../build/yui/yui-min.js"></script>
       
    12     
       
    13 </head>
       
    14 <body>
       
    15 <!--
       
    16 <a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
       
    17 -->
       
    18 <div id="doc">
       
    19     <div id="hd">
       
    20         <h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1>
       
    21     </div>
       
    22     
       
    23 
       
    24             <h1>Example: ScrollView with Scroll Indicator and Link Suppression Behavior</h1>
       
    25     <div class="yui3-g">
       
    26         <div class="yui3-u-3-4">
       
    27             <div id="main">
       
    28                 <div class="content"><div class="intro">
       
    29     <p>This example shows how to create a ScrollView widget with a scrollbar indicator.  It also illustrates a technique for suppressing link behavior during a scroll &mdash; a technique you may require if you have a ScrollView instance heavily populated by links, as in this example.</p>
       
    30 </div>
       
    31 
       
    32 <div class="example newwindow">
       
    33     <a href="scrollview-example.html" target="_blank" class="button">
       
    34         View Example in New Window
       
    35     </a>
       
    36 </div>
       
    37 
       
    38 <h2>The ScrollView Widget With A Scroll Indicator</h2>
       
    39 
       
    40 <p>In this example, we'll create a ScrollView instance, which also has a scrollbar indicator.</p>
       
    41 
       
    42 <h3>Modules Used</h3>
       
    43 
       
    44 <p>Since we want to use the base ScrollView, along with the ScrollViewScrollbars plugin, which provides the scrollbar indicator we use the <code>scrollview</code> module, instead of the <code>scrollview-base</code> module we used for the basic ScrollView example:</p>
       
    45 
       
    46 <pre class="code prettyprint">&#x2F;&#x2F; Pulls in scrollview-base and scrollview-scrollbars plugin 
       
    47 &#x2F;&#x2F; and plugs it in (at the class level)
       
    48 
       
    49 YUI().use(&#x27;scrollview&#x27;, function(Y) {
       
    50     ...
       
    51 });</pre>
       
    52 
       
    53 
       
    54 <p>The <code>scrollview</code> module pulls in the basic ScrollView and also the ScrollViewScrollbars plugin. It has code which plugs the scrollbar plugin into the ScrollView base class:</p>
       
    55 
       
    56 <pre class="code prettyprint">Y.Base.plug(Y.ScrollView, Y.Plugin.ScrollViewScrollbars);</pre>
       
    57 
       
    58 
       
    59 <h3>Instantiating The ScrollView Widget</h3>
       
    60 
       
    61 <p>
       
    62 <strong>Note:</strong> be sure to add the <code>yui3-skin-sam</code> classname to the
       
    63 page's <code>&lt;body&gt;</code> element or to a parent element of the widget in order to apply
       
    64 the default CSS skin. See <a href="http://yuilibrary.com/yui/docs/tutorials/skins/">Understanding Skinning</a>.
       
    65 </p>
       
    66 <pre class="code prettyprint">&lt;body class=&quot;yui3-skin-sam&quot;&gt; &lt;!-- You need this skin class --&gt;</pre>
       
    67 
       
    68 
       
    69 <p>As with the <a href="scrollview-base.html">Base ScrollView</a> example, we provide the markup for the ScrollView content on the page, as shown below:</p>
       
    70 
       
    71 <pre class="code prettyprint">&lt;div id=&quot;scrollview-content&quot; class=&quot;yui3-scrollview-loading&quot;&gt;
       
    72     &lt;ul&gt;
       
    73         &lt;li&gt;AC&#x2F;DC&lt;&#x2F;li&gt;
       
    74         &lt;li&gt;Aerosmith&lt;&#x2F;li&gt;
       
    75         &lt;li&gt;Billy Joel&lt;&#x2F;li&gt;
       
    76         &lt;li&gt;Bob Dylan&lt;&#x2F;li&gt;
       
    77         ...
       
    78     &lt;&#x2F;ul&gt;
       
    79 &lt;&#x2F;div&gt;</pre>
       
    80 
       
    81 
       
    82 <p>And we instantiate the ScrollView instance in the same way, providing the <code>srcNode</code> attribute during construction, so it uses the markup above for it's content:</p>
       
    83 
       
    84 <pre class="code prettyprint">YUI().use(&#x27;scrollview&#x27;, function(Y) {
       
    85 
       
    86     var scrollView = new Y.ScrollView({
       
    87         id: &quot;scrollview&quot;,
       
    88         srcNode: &#x27;#scrollview-content&#x27;,
       
    89         height: 310,
       
    90         flick: {
       
    91             minDistance:10,
       
    92             minVelocity:0.3,
       
    93             axis: &quot;y&quot;
       
    94         }
       
    95     });
       
    96 
       
    97     scrollView.render();
       
    98 });</pre>
       
    99 
       
   100 
       
   101 <p>Again, for this example, since we want a vertically scrolling ScrollView widget, we also give it a height during construction and constrain flicks to the "y" axis.</p>
       
   102 
       
   103 <p>As the last step, to see the functional ScrollView on the page, we call <code>scrollView.render()</code>.</p>
       
   104 
       
   105 <p>The only difference, compared to the <a href="scrollview-base.html">Base ScrollView</a> example, is that the ScrollViewScrollbars plugin has been pulled down and plugged in by the <code>scrollview</code> module code shown above, so the ScrollView now has a scroll indicator. The scroll indicator is styled with rounded corners in browsers which support CSS rounded corners natively.</p>
       
   106 
       
   107 <h3>Accessing The Scrollbars Plugin API</h3>
       
   108 
       
   109 <p>As discussed in the <a href="index.html#scrollbars">ScrollBar Plugin</a> documentation, the API to control scrollbars is available on the scrollview instance, through the <code>scrollView.scrollbars</code> property. The ScrollBar plugin doesn't have too complex of an api, just a few methods to hide and show the scrollbars:</p>
       
   110 
       
   111 <pre class="code prettyprint">&#x2F;* 
       
   112   scrollView.scrollbars is an instance of the ScrollViewScrollbars plugin 
       
   113 *&#x2F;
       
   114 scrollView.scrollbars.hide();
       
   115 scrollView.scrollbars.show(); 
       
   116 scrollView.scrollbars.flash();
       
   117 });</pre>
       
   118 
       
   119 
       
   120 <h3>Suppressing Default Link Behavior</h3>
       
   121 
       
   122 <p>In this example, the scrolling surface is populated with links. To prevent links' default action (page navigation) from taking place after a scroll, we look at the <code>lastScrolledAmt</code> property of our ScrollView instance; on a simple click, that number will be very close to zero, whereas after scroll that number will be much higher.  In this case, we're using a 2px threshold.</p>
       
   123 
       
   124 <pre class="code prettyprint">var content = scrollView.get(&quot;contentBox&quot;); 
       
   125 
       
   126 content.delegate(&quot;click&quot;, function(e) {
       
   127     &#x2F;&#x2F; Prevent links from navigating as part of a scroll gesture
       
   128     if (Math.abs(scrollView.lastScrolledAmt) &gt; 2) {
       
   129         e.preventDefault();
       
   130         Y.log(&quot;Link behavior suppressed.&quot;)
       
   131     }
       
   132 }, &quot;a&quot;);</pre>
       
   133 
       
   134 
       
   135 <p>We also prevent default on mousedown, to prevent the native "drag link to desktop" behavior on certain browsers.</p>
       
   136 
       
   137 <pre class="code prettyprint">content.delegate(&quot;mousedown&quot;, function(e) {
       
   138     &#x2F;&#x2F; Prevent default anchor drag behavior, on browsers 
       
   139     &#x2F;&#x2F; which let you drag anchors to the desktop
       
   140     e.preventDefault();
       
   141 }, &quot;a&quot;);</pre>
       
   142 
       
   143 
       
   144 <h2>Complete Example Source</h2>
       
   145 
       
   146 <p>
       
   147 <strong>Note:</strong> be sure to add the <code>yui3-skin-sam</code> classname to the
       
   148 page's <code>&lt;body&gt;</code> element or to a parent element of the widget in order to apply
       
   149 the default CSS skin. See <a href="http://yuilibrary.com/yui/docs/tutorials/skins/">Understanding Skinning</a>.
       
   150 </p>
       
   151 <pre class="code prettyprint">&lt;body class=&quot;yui3-skin-sam&quot;&gt; &lt;!-- You need this skin class --&gt;</pre>
       
   152 
       
   153 
       
   154 <pre class="code prettyprint">&lt;div id=&quot;scrollview-container&quot;&gt;
       
   155     &lt;div id=&quot;scrollview-header&quot;&gt;
       
   156         &lt;h1&gt;ScrollView&lt;&#x2F;h1&gt;
       
   157     &lt;&#x2F;div&gt;
       
   158     &lt;div id=&quot;scrollview-content&quot; class=&quot;yui3-scrollview-loading&quot;&gt;
       
   159         &lt;ul&gt; 
       
   160             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.acdc.com&#x2F;&quot; title=&quot;AC&#x2F;DC | The Official AC&#x2F;DC Site&quot;&gt;AC&#x2F;DC&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   161             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.aerosmith.com&#x2F;&quot; title=&quot;Aerosmith | Aerosmith -&quot;&gt;Aerosmith&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   162             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.billyjoel.com&#x2F;&quot; title=&quot;Billy Joel | The Official Billy Joel Site&quot;&gt;Billy Joel&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   163             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.bobdylan.com&#x2F;&quot; title=&quot;Home Page | Bob Dylan&quot;&gt;Bob Dylan&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   164             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.bobseger.com&#x2F;&quot; title=&quot;Bob Seger | Official Site | Home&quot;&gt;Bob Seger&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   165             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.bonjovi.com&#x2F;&quot; title=&quot;Bon Jovi &amp;#134; The Official Website&quot;&gt;Bon Jovi&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   166             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.brucespringsteen.net&#x2F;&quot; title=&quot;BRUCE SPRINGSTEEN IS AWESOME&quot;&gt;Bruce Springsteen&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   167             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.creed.com&#x2F;&quot; title=&quot;Creed.com – The Official Website of Creed&quot;&gt;Creed&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   168             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Creedence_Clearwater_Revival&quot; title=&quot;Creedence Clearwater Revival - Wikipedia, the free encyclopedia&quot;&gt;Creedence Clearwater Revival&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   169             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.davematthewsband.com&#x2F;&quot; title=&quot;DAVE MATTHEWS BAND | Home Page | Dave Matthews Band&quot;&gt;Dave Matthews Band&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   170             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.defleppard.com&#x2F;news&#x2F;&quot; title=&quot;DefLeppard.com | the official Def Leppard web site&quot;&gt;Def Leppard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   171             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.eaglesband.com&#x2F;&quot; title=&quot;Eagles | eaglesband.com&quot;&gt;The Eagles&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
       
   172 					&lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.bunnymen.com&#x2F;&quot; title=&quot;Echo &amp;amp; The Bunnymen&quot;&gt;Echo and the Bunnymen&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
       
   173             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.eminem.com&#x2F;&quot; title=&quot;Eminem : Official Site&quot;&gt;Eminem&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   174             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.fleetwoodmac.com&#x2F;&quot; title=&quot;Fleetwood Mac&quot;&gt;Fleetwood Mac&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   175             &lt;li&gt;Green Day&lt;&#x2F;li&gt; 
       
   176             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.gunsnroses.com&#x2F;&quot; title=&quot;Guns N&#x27; Roses: Home: Chinese Democracy&quot;&gt;Guns N&#x27; Roses&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   177             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.jamestaylor.com&#x2F;&quot; title=&quot;James Taylor: The Official Site&quot;&gt;James Taylor&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   178             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.jay-z.com&#x2F;index.php&quot; title=&quot;Jay-Z.com: The Official Jay-Z Website&quot;&gt;Jay-Z&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   179             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Jimi_Hendrix&quot; title=&quot;Jimi Hendrix - Wikipedia, the free encyclopedia&quot;&gt;Jimi Hendrix&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   180             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.ledzeppelin.com&#x2F;&quot; title=&quot;Led Zeppelin - Official Website&quot;&gt;Led Zeppelin&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   181             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.lynyrdskynyrd.com&#x2F;&quot; title=&quot;Lynyrd Skynyrd&quot;&gt;Lynyrd Skynyrd&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   182             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;metallica.com&#x2F;&quot; title=&quot;Metallica.com&quot;&gt;Metallica&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   183             &lt;li&gt;Motley Crue&lt;&#x2F;li&gt; 
       
   184             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.neildiamond.com&#x2F;&quot; title=&quot;Official site from Neil Diamond&quot;&gt;Neil Diamond&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   185             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Nirvana_(band)&quot; title=&quot;Nirvana (band) - Wikipedia, the free encyclopedia&quot;&gt;Nirvana&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   186             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.ozzy.com&#x2F;&quot; title=&quot;Ozzy Osbourne | The Official Ozzy Osbourne Site&quot;&gt;Ozzy Osbourne&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   187             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;pearljam.com&#x2F;&quot; title=&quot;Home | Pearl Jam - Ten Club&quot;&gt;Pearl Jam&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   188             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.pinkfloyd.com&#x2F;&quot; title=&quot;Pink Floyd | The Official Site&quot;&gt;Pink Floyd&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   189             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.queenonline.com&#x2F;&quot; title=&quot;Queen Online.com&quot;&gt;Queen&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   190             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.rodstewart.com&#x2F;&quot; title=&quot;Rod Stewart | The Official Rod Stewart Site&quot;&gt;Rod Stewart&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   191             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.rush.com&#x2F;&quot; title=&quot;RUSH - Official Website&quot;&gt;Rush&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   192             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.santana.com&#x2F;&quot; title=&quot;SANTANA - The Official Carlos Santana Web Site&quot;&gt;Santana&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   193             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.simonandgarfunkel.com&#x2F;&quot; title=&quot;Simon &amp;amp; Garfunkel official site&quot;&gt;Simon and Garfunkel&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   194             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.stevemillerband.com&#x2F;&quot; title=&quot;Steve Miller Band - Official Web Site&quot;&gt;Steve Miller Band&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   195             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.thebeatles.com&#x2F;&quot; title=&quot;The Beatles&quot;&gt;The Beatles&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   196             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.thedoors.com&#x2F;&quot; title=&quot;The Doors&quot;&gt;The Doors&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   197             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.thepolicefile.com&#x2F;&quot; title=&quot;ThePoliceFile.com: The Police - Concert Tickets - World Tour - The Police&quot;&gt;The Police&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   198             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.rollingstones.com&#x2F;&quot; title=&quot;The Official site of the Rolling Stones | Rollingstones.com&quot;&gt;The Rolling Stones&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   199             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.tompetty.com&#x2F;&quot; title=&quot;TomPetty.com &amp;gt; Home&quot;&gt;Tom Petty&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   200             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.u2.com&#x2F;&quot; title=&quot;U2 &amp;gt; Welcome&quot;&gt;U2&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   201             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.van-halen.com&#x2F;&quot; title=&quot;Van-Halen.com | the official Van Halen web site&quot;&gt;Van Halen&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   202             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.willienelson.com&#x2F;&quot; title=&quot;Home &amp;raquo; 
       
   203             			Willie Nelson&quot;&gt;Willie Nelson&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   204             &lt;li&gt;&lt;a href=&quot;http:&#x2F;&#x2F;www.zztop.com&#x2F;&quot; title=&quot;ZZ Top | Home&quot;&gt;ZZ Top&lt;&#x2F;a&gt;&lt;&#x2F;li&gt; 
       
   205         &lt;&#x2F;ul&gt;
       
   206     &lt;&#x2F;div&gt;
       
   207 &lt;&#x2F;div&gt;
       
   208 
       
   209 &lt;div id=&quot;additional-content&quot;&gt;
       
   210     &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras aliquam hendrerit elit id vulputate. Pellentesque pellentesque erat rutrum velit facilisis sodales convallis tellus lacinia. Curabitur gravida mi sit amet nulla suscipit sed congue dolor volutpat. Aenean sem tortor, pretium et euismod in, imperdiet sit amet urna. Ut ante nisi, auctor mattis suscipit a, ullamcorper eget leo. Phasellus sagittis ante at lectus rutrum ut sollicitudin sem malesuada. Duis ultrices sapien et nulla tincidunt malesuada. Mauris ante turpis, dignissim eu tincidunt vitae, placerat quis diam. In augue nisl, cursus at rutrum ut, scelerisque et erat. Suspendisse potenti. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris orci dui, aliquam ut convallis ut, dapibus et erat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam erat volutpat. Mauris placerat elit id lectus rhoncus in dignissim justo mollis. Donec nec odio sapien. In iaculis euismod felis non laoreet. Mauris ornare varius neque, et congue erat porta a. Aliquam nec auctor lectus. Etiam ut ipsum a nibh iaculis fringilla.&lt;&#x2F;p&gt;
       
   211     &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras aliquam hendrerit elit id vulputate. Pellentesque pellentesque erat rutrum velit facilisis sodales convallis tellus lacinia. Curabitur gravida mi sit amet nulla suscipit sed congue dolor volutpat. Aenean sem tortor, pretium et euismod in, imperdiet sit amet urna. Ut ante nisi, auctor mattis suscipit a, ullamcorper eget leo. Phasellus sagittis ante at lectus rutrum ut sollicitudin sem malesuada. Duis ultrices sapien et nulla tincidunt malesuada. Mauris ante turpis, dignissim eu tincidunt vitae, placerat quis diam. In augue nisl, cursus at rutrum ut, scelerisque et erat. Suspendisse potenti. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris orci dui, aliquam ut convallis ut, dapibus et erat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam erat volutpat. Mauris placerat elit id lectus rhoncus in dignissim justo mollis. Donec nec odio sapien. In iaculis euismod felis non laoreet. Mauris ornare varius neque, et congue erat porta a. Aliquam nec auctor lectus. Etiam ut ipsum a nibh iaculis fringilla.&lt;&#x2F;p&gt;
       
   212 &lt;&#x2F;div&gt;
       
   213 
       
   214 &lt;script type=&quot;text&#x2F;javascript&quot; charset=&quot;utf-8&quot;&gt;
       
   215     YUI().use(&#x27;scrollview&#x27;, function(Y) {
       
   216 
       
   217         var scrollView = new Y.ScrollView({
       
   218             id: &quot;scrollview&quot;,
       
   219             srcNode: &#x27;#scrollview-content&#x27;,
       
   220             height: 310,
       
   221             flick: {
       
   222                 minDistance:10,
       
   223                 minVelocity:0.3,
       
   224                 axis: &quot;y&quot;
       
   225             }
       
   226         });
       
   227 
       
   228         scrollView.render();
       
   229         
       
   230         var content = scrollView.get(&quot;contentBox&quot;); 
       
   231 
       
   232 				content.delegate(&quot;click&quot;, function(e) {
       
   233 				    &#x2F;&#x2F; Prevent links from navigating as part of a scroll gesture
       
   234 				    if (Math.abs(scrollView.lastScrolledAmt) &gt; 2) {
       
   235 				        e.preventDefault();
       
   236 						Y.log(&quot;Link behavior suppressed.&quot;)
       
   237 				    }
       
   238 				}, &quot;a&quot;);
       
   239 
       
   240         content.delegate(&quot;mousedown&quot;, function(e) {
       
   241             &#x2F;&#x2F; Prevent default anchor drag behavior, on browsers which let you drag anchors to the desktop
       
   242             e.preventDefault();
       
   243         }, &quot;a&quot;);
       
   244     });
       
   245 
       
   246 &lt;&#x2F;script&gt;</pre>
       
   247 
       
   248 </div>
       
   249             </div>
       
   250         </div>
       
   251 
       
   252         <div class="yui3-u-1-4">
       
   253             <div class="sidebar">
       
   254                 
       
   255 
       
   256                 
       
   257                     <div class="sidebox">
       
   258                         <div class="hd">
       
   259                             <h2 class="no-toc">Examples</h2>
       
   260                         </div>
       
   261 
       
   262                         <div class="bd">
       
   263                             <ul class="examples">
       
   264                                 
       
   265                                     
       
   266                                         <li data-description="This example creates a basic ScrollView which doesn&#x27;t include a scrollbar indicator.">
       
   267                                             <a href="scrollview-base.html">Basic ScrollView Without a Scroll Indicator</a>
       
   268                                         </li>
       
   269                                     
       
   270                                 
       
   271                                     
       
   272                                         <li data-description="This example shows the classic Scrollview implementation, including scroll indicators (bars) and including code to suppress link navigation while scrolling.">
       
   273                                             <a href="scrollview-scroll.html">ScrollView with Scroll Indicator and Link Suppression Behavior</a>
       
   274                                         </li>
       
   275                                     
       
   276                                 
       
   277                                     
       
   278                                         <li data-description="This example creates a horizontal ScrollView.">
       
   279                                             <a href="scrollview-horiz.html">Horizontal ScrollView</a>
       
   280                                         </li>
       
   281                                     
       
   282                                 
       
   283                                     
       
   284                                         <li data-description="This example creates a horizontal ScrollView with pagination support.">
       
   285                                             <a href="scrollview-paging.html">ScrollView With Pagination</a>
       
   286                                         </li>
       
   287                                     
       
   288                                 
       
   289                             </ul>
       
   290                         </div>
       
   291                     </div>
       
   292                 
       
   293 
       
   294                 
       
   295             </div>
       
   296         </div>
       
   297     </div>
       
   298 </div>
       
   299 
       
   300 <script src="../assets/vendor/prettify/prettify-min.js"></script>
       
   301 <script>prettyPrint();</script>
       
   302 
       
   303 <script>
       
   304 YUI.Env.Tests = {
       
   305     examples: [],
       
   306     project: '../assets',
       
   307     assets: '../assets/scrollview',
       
   308     name: 'scrollview-scroll',
       
   309     title: 'ScrollView with Scroll Indicator and Link Suppression Behavior',
       
   310     newWindow: 'true',
       
   311     auto:  false 
       
   312 };
       
   313 YUI.Env.Tests.examples.push('scrollview-base');
       
   314 YUI.Env.Tests.examples.push('scrollview-scroll');
       
   315 YUI.Env.Tests.examples.push('scrollview-horiz');
       
   316 YUI.Env.Tests.examples.push('scrollview-paging');
       
   317 
       
   318 </script>
       
   319 <script src="../assets/yui/test-runner.js"></script>
       
   320 
       
   321 
       
   322 
       
   323 </body>
       
   324 </html>