5
<title>Example: Floated List</title>
6
<link rel="stylesheet" href="http://yui.yahooapis.com/3.4.0pr3/build/cssgrids/grids-min.css">
7
<link rel="stylesheet" href="../assets/css/main.css">
8
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
9
<script src="../../build/yui/yui-min.js"></script>
14
<h1>Example: Floated List</h1>
17
<a href="#toc" class="jump">Jump to Table of Contents</a>
21
<div id="main" class="yui3-u">
22
<div class="content"><div class="intro">
23
<p>Making a simple sortable list with floated nodes.</p>
29
border: 1px solid black;
37
border: 1px solid black;
39
background-color: #8DD5E7;
61
YUI().use('sortable', function(Y) {
62
var sortable = new Y.Sortable({
73
<h3 id="setting-up-the-list">Setting Up the List</h3>
74
<p>First we need to create the HTML structure for the list. Since <code>Sortable</code> uses <code>Y.DD.Delegate</code>, we need to set up a delegation container (<code>#demo</code>) and the list items (<code>em</code>).</p>
76
<pre class="code prettyprint"><div id="demo">
77
<em>Item #1</em>
78
<em>Item #2</em>
79
<em>Item #3</em>
80
<em>Item #4</em>
81
<em>Item #5</em>
82
<em>Item #6</em>
83
<em>Item #7</em>
84
<em>Item #8</em>
85
<em>Item #9</em>
86
<em>Item #10</em>
87
</div></pre>
90
<p>Now we give the list some CSS to make it visible.</p>
92
<pre class="code prettyprint">#demo {
93
border: 1px solid black;
101
border: 1px solid black;
103
background-color: #8DD5E7;
108
<h3 id="setting-up-the-yui-instance">Setting Up the YUI Instance</h3>
109
<p>Now we need to create our YUI instance and tell it to load the <code>sortable</code> module.</p>
111
<pre class="code prettyprint">YUI().use('sortable'</pre>
114
<h3 id="making-the-list-draggable">Making the List Draggable</h3>
115
<p>Now that we have a YUI instance with the <code>sortable</code> module, we need to instantiate the <code>Sortable</code> instance on the list.</p>
117
<pre class="code prettyprint">YUI().use('sortable', function(Y) {
118
var sortable = new Y.Sortable({
119
container: '#demo',
120
nodes: 'em',
121
opacity: '.1'
128
<div id="sidebar" class="yui3-u">
130
<div id="toc" class="sidebox">
132
<h2 class="no-toc">Table of Contents</h2>
138
<a href="#setting-up-the-list">Setting Up the List</a>
141
<a href="#setting-up-the-yui-instance">Setting Up the YUI Instance</a>
144
<a href="#making-the-list-draggable">Making the List Draggable</a>
152
<div class="sidebox">
154
<h2 class="no-toc">Examples</h2>
158
<ul class="examples">
161
<li data-description="Create a simple sortable list.">
162
<a href="simple-sortable.html">Simple Sortable List</a>
167
<li data-description="Sortable list example with floated nodes.">
168
<a href="sortable-float.html">Floated List</a>
173
<li data-description="Multiple Sortable Lists that are separate from one another.">
174
<a href="sortable-multi.html">Multiple Lists</a>
179
<li data-description="Multiple Sortable Lists that are fully joined together.">
180
<a href="sortable-multi-full.html">Multiple Lists - Full Join</a>
185
<li data-description="Multiple Sortable Lists that are outer joined together.">
186
<a href="sortable-multi-out.html">Multiple Lists - Outer Join</a>
191
<li data-description="Multiple Sortable Lists that are inner joined together.">
192
<a href="sortable-multi-in.html">Multiple Lists - Inner Join</a>
206
<script src="../assets/vendor/prettify/prettify-min.js"></script>
207
<script>prettyPrint();</script>