~bcsaller/juju-gui/charmFind

« back to all changes in this revision

Viewing changes to lib/yui/docs/node-menunav/node-menunav-2.html

  • Committer: kapil.foss at gmail
  • Date: 2012-07-13 18:45:59 UTC
  • Revision ID: kapil.foss@gmail.com-20120713184559-2xl7be17egsrz0c9
reshape

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html lang="en">
3
 
<head>
4
 
    <meta charset="utf-8">
5
 
    <title>Example: Basic Top Nav</title>
6
 
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Maven+Pro:400,700">
7
 
    <link rel="stylesheet" href="../../build/cssgrids/grids-min.css">
8
 
    <link rel="stylesheet" href="../assets/css/main.css">
9
 
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
10
 
    <script src="../../build/yui/yui-min.js"></script>
11
 
</head>
12
 
<body>
13
 
 
14
 
<div id="doc">
15
 
    <h1>Example: Basic Top Nav</h1>
16
 
 
17
 
    
18
 
 
19
 
    <div class="yui3-g">
20
 
        <div class="yui3-u-3-4">
21
 
            <div id="main">
22
 
                <div class="content"><div class="intro">
23
 
    <p>
24
 
    This example demonstrates how to create a traditional, two-column page layout (<a href="../cssgrids/index.html">using Grids</a>) with top navigation featuring drop-down menus.
25
 
    </p>
26
 
</div>
27
 
 
28
 
<div class="example newwindow">
29
 
    <a href="node-menunav-2-example.html" target="_blank" class="button">
30
 
        View Example in New Window
31
 
    </a>
32
 
</div>
33
 
 
34
 
<h2>Setting Up the HTML</h2>
35
 
 
36
 
<p>
37
 
Begin by including the <a href="../cssgrids/index.html#dependencies">CSS Grids dependencies</a> and grid
38
 
markup (this example uses a 2 column version of the
39
 
<a href="../cssgrids/cssgrids-fluid.html">Fluid Page Template</a> with a 160px left column).
40
 
Add the markup for the menu to the left column of the grid, and the class <code>yui3-skin-sam</code>
41
 
to the <code>&#60;body&#62;</code>.
42
 
</p>
43
 
 
44
 
<p>
45
 
The root menu of menus built using the MenuNav Node Plugin can have a verical or horizontal
46
 
orientation.  The default orientation for menus is vertical, but can be easily switched to
47
 
horizontal by applying a class of <code>yui3-menu-horizontal</code> to the node representing the
48
 
root menu's bounding box, as illustrated below:
49
 
</p>
50
 
 
51
 
<pre class="code prettyprint">&lt;div id=&quot;productsandservices&quot; class=&quot;yui3-menu yui3-menu-horizontal&quot;&gt;&lt;!-- Bounding box --&gt;
52
 
    &lt;div class=&quot;yui3-menu-content&quot;&gt;&lt;!-- Content box --&gt;
53
 
        &lt;ul&gt;
54
 
            &lt;!-- Menu items --&gt;
55
 
        &lt;&#x2F;ul&gt;
56
 
    &lt;&#x2F;div&gt;
57
 
&lt;&#x2F;div&gt;</pre>
58
 
 
59
 
 
60
 
 
61
 
<h2>Initializing the Menu</h2>
62
 
<p>
63
 
With the menu markup in place, retrieve the Node instance representing the root
64
 
menu (<code>&#60;div id="productsandservices"&#62;</code>) and call the
65
 
<a href="http://yuilibrary.com/yui/docs/api/classes/Node.html#method_plug"><code>plug</code></a>
66
 
passing in a reference to the MenuNav Node Plugin.
67
 
</p>
68
 
 
69
 
<pre class="code prettyprint">&#x2F;&#x2F;  Call the &quot;use&quot; method, passing in &quot;node-menunav&quot;.  This will load the
70
 
&#x2F;&#x2F;  script and CSS for the MenuNav Node Plugin and all of the required
71
 
&#x2F;&#x2F;  dependencies.
72
 
 
73
 
YUI().use(&#x27;node-menunav&#x27;, function(Y) {
74
 
 
75
 
    &#x2F;&#x2F;  Retrieve the Node instance representing the root menu
76
 
    &#x2F;&#x2F;  (&lt;div id=&quot;productsandservices&quot;&gt;) and call the &quot;plug&quot; method
77
 
    &#x2F;&#x2F;  passing in a reference to the MenuNav Node Plugin.
78
 
 
79
 
    var menu = Y.one(&quot;#productsandservices&quot;);
80
 
 
81
 
    menu.plug(Y.Plugin.NodeMenuNav);
82
 
 
83
 
});</pre>
84
 
 
85
 
 
86
 
<p>
87
 
<em>Note:</em> In keeping with the
88
 
<a href="http://developer.yahoo.com/performance/">Exceptional Performance</a>
89
 
team's recommendation, the script block used to instantiate the menu will be
90
 
<a href="http://developer.yahoo.com/performance/rules.html#js_bottom">placed at the bottom of the page</a>.
91
 
This not only improves performance, it helps ensure that the DOM subtree of the
92
 
element representing the root menu
93
 
(<code>&#60;div id="productsandservices"&#62;</code>) is ready to be scripted.
94
 
</p>
95
 
</div>
96
 
            </div>
97
 
        </div>
98
 
 
99
 
        <div class="yui3-u-1-4">
100
 
            <div class="sidebar">
101
 
                
102
 
 
103
 
                
104
 
                    <div class="sidebox">
105
 
                        <div class="hd">
106
 
                            <h2 class="no-toc">Examples</h2>
107
 
                        </div>
108
 
 
109
 
                        <div class="bd">
110
 
                            <ul class="examples">
111
 
                                
112
 
                                    
113
 
                                        <li data-description="Creating left navigation using the MenuNav Node Plugin.">
114
 
                                            <a href="menunav-leftnav.html">Basic Left Nav</a>
115
 
                                        </li>
116
 
                                    
117
 
                                
118
 
                                    
119
 
                                        <li data-description="Creating top navigation using the MenuNav Node Plugin">
120
 
                                            <a href="node-menunav-2.html">Basic Top Nav</a>
121
 
                                        </li>
122
 
                                    
123
 
                                
124
 
                                    
125
 
                                        <li data-description="Creating menu button navigation using the MenuNav Node Plugin">
126
 
                                            <a href="node-menunav-3.html">Menu Button Top Nav</a>
127
 
                                        </li>
128
 
                                    
129
 
                                
130
 
                                    
131
 
                                        <li data-description="Creating split button navigation using the MenuNav Node Plugin">
132
 
                                            <a href="node-menunav-4.html">Split Button Top Nav</a>
133
 
                                        </li>
134
 
                                    
135
 
                                
136
 
                                    
137
 
                                        <li data-description="Adding shadows to submenus of a left nav using the MenuNav Node Plugin">
138
 
                                            <a href="node-menunav-5.html">Left Nav with Submenus with Shadows</a>
139
 
                                        </li>
140
 
                                    
141
 
                                
142
 
                                    
143
 
                                        <li data-description="Adding rounded corners to submenus of a left nav using the MenuNav Node Plugin">
144
 
                                            <a href="node-menunav-6.html">Left Nav With Submenus With Rounded Corners</a>
145
 
                                        </li>
146
 
                                    
147
 
                                
148
 
                                    
149
 
                                        <li data-description="Skining a menu built using the MenuNav Node Plugin to look like the menus on Flickr">
150
 
                                            <a href="node-menunav-7.html">Skinning Menus Created Using the MenuNav Node Plugin</a>
151
 
                                        </li>
152
 
                                    
153
 
                                
154
 
                            </ul>
155
 
                        </div>
156
 
                    </div>
157
 
                
158
 
 
159
 
                
160
 
            </div>
161
 
        </div>
162
 
    </div>
163
 
</div>
164
 
 
165
 
<script src="../assets/vendor/prettify/prettify-min.js"></script>
166
 
<script>prettyPrint();</script>
167
 
 
168
 
</body>
169
 
</html>