src/cm/media/js/lib/yui/yui_3.10.3/docs/node-menunav/node-menunav-6.html
changeset 525 89ef5ed3c48b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cm/media/js/lib/yui/yui_3.10.3/docs/node-menunav/node-menunav-6.html	Tue Jul 16 14:29:46 2013 +0200
@@ -0,0 +1,339 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>Example: Left Nav With Submenus With Rounded Corners</title>
+    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic">
+    <link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css">
+    <link rel="stylesheet" href="../assets/css/main.css">
+    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
+    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
+    <script src="../../build/yui/yui-min.js"></script>
+    
+</head>
+<body>
+<!--
+<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>
+-->
+<div id="doc">
+    <div id="hd">
+        <h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1>
+    </div>
+    
+
+            <h1>Example: Left Nav With Submenus With Rounded Corners</h1>
+    <div class="yui3-g">
+        <div class="yui3-u-3-4">
+            <div id="main">
+                <div class="content"><div class="intro">
+    <p>
+    This example demonstrates how to add rounded corners to submenus of a menu built using the
+    MenuNav Node Plugin.
+    </p>
+</div>
+
+<div class="example newwindow">
+    <a href="node-menunav-6-example.html" target="_blank" class="button">
+        View Example in New Window
+    </a>
+</div>
+
+<h2>Creating the Rounded Corner HTML</h2>
+<p>
+<strong>Note:</strong> be sure to add the <code>yui3-skin-sam</code> classname to the
+page's <code>&lt;body&gt;</code> element or to a parent element of the widget in order to apply
+the default CSS skin. See <a href="http://yuilibrary.com/yui/docs/tutorials/skins/">Understanding Skinning</a>.
+</p>
+<pre class="code prettyprint">&lt;body class=&quot;yui3-skin-sam&quot;&gt; &lt;!-- You need this skin class --&gt;</pre>
+
+<p>
+One way to add rounded corners to submenus is to append decorator elements to the node representing
+a submenu's bounding box.  As the name implies, decorator elements add no semantic value to the
+markup, but enable additional styles to be applied.  When adding any decorator elements to create
+effects like shadows or rounded corners, always add those elements via JavaScript, since it is only
+when JavaScript is enabled that a menu's markup is transformed in a drop-down menu system via the
+MenuNav Node Plugin.
+</p>
+
+<p>
+Each rounded corner is created by applying a background image to a <code>&#60;div&#62;</code>.
+A class name identifying the corner will be added to each <code>&#60;div&#62;</code>.
+The <code>&#60;div&#62;</code>s used to create the right corners will be nested inside the
+<code>&#60;div&#62;</code>s used to create the left corners, and each <code>&#60;div&#62;</code>
+for the left corners will have an additional class name of <code>yui3-menu-corner</code>.  The
+template for each set of rounded corners comes together as follows:
+</p>
+
+<pre class="code prettyprint">&lt;!-- top-left and top-right corners --&gt;
+&lt;div class=&quot;yui3-menu-corner yui3-menu-corner-tl&quot;&gt;&lt;div class=&quot;yui3-menu-corner-tr&quot;&gt;&lt;&#x2F;div&gt;&lt;&#x2F;div&gt;
+
+&lt;!-- bottom-left and bottom-right corners --&gt;
+&lt;div class=&quot;yui3-menu-corner yui3-menu-corner-bl&quot;&gt;&lt;div class=&quot;yui3-menu-corner-br&quot;&gt;&lt;&#x2F;div&gt;&lt;&#x2F;div&gt;</pre>
+
+
+<p>
+The <code>&#60;div&#62;</code>s for each corner is created by passing a string
+of HTML to Node's <a href="http://yuilibrary.com/yui/docs/api/classes/Node.html#method_create"><code>create</code></a> method.  Use
+the <a href="http://yuilibrary.com/yui/docs/api/classes/Node.html#method_all"><code>all</code></a> method to
+retrieve Node instances for each submenu, and the
+<a href="http://yuilibrary.com/yui/docs/api/classes/Node.html#method_append"><code>append</code></a> and
+<a href="http://yuilibrary.com/yui/docs/api/classes/Node.html#method_prepend"><code>prepend</code></a>
+methods to add the rounded corners <code>&#60;div&#62;</code>s to the bounding box of each submenu.
+</p>
+
+<pre class="code prettyprint">&#x2F;&#x2F;  Call the &quot;use&quot; method, passing in &quot;node-menunav&quot;.  This will load the
+&#x2F;&#x2F;  script and CSS for the MenuNav Node Plugin and all of the required
+&#x2F;&#x2F;  dependencies.
+
+YUI().use(&#x27;node-menunav&#x27;, function(Y) {
+
+    &#x2F;&#x2F;  Retrieve the Node instance representing the root menu
+    &#x2F;&#x2F;  (&lt;div id=&quot;productsandservices&quot;&gt;)
+
+    var menu = Y.one(&quot;#productsandservices&quot;);
+
+
+    &#x2F;&#x2F;  Use the &quot;all&quot; method to retrieve the
+    &#x2F;&#x2F;  Node instances representing each submenu.
+
+    menu.all(&quot;.yui3-menu&quot;).each(function (node) {
+
+        &#x2F;&#x2F;  Add decorator elements used to create the rounded corners to the
+        &#x2F;&#x2F;  bounding box of each submenu.
+
+        &#x2F;&#x2F; Insert the first decorator before the submenu&#x27;s content box
+        node.prepend(&#x27;&lt;div class=&quot;yui3-menu-corner yui3-menu-corner-tl&quot;&gt;&lt;div class=&quot;yui3-menu-corner-tr&quot;&gt;&lt;&#x2F;div&gt;&lt;&#x2F;div&gt;&#x27;);
+
+        &#x2F;&#x2F; Insert the second decorator after the submenu&#x27;s content box
+        node.append(&#x27;&lt;div class=&quot;yui3-menu-corner yui3-menu-corner-bl&quot;&gt;&lt;div class=&quot;yui3-menu-corner-br&quot;&gt;&lt;&#x2F;div&gt;&lt;&#x2F;div&gt;&#x27;);
+
+    });
+
+
+    &#x2F;&#x2F;  Call the &quot;plug&quot; method of the Node instance, passing in a reference to the
+    &#x2F;&#x2F;  MenuNav Node Plugin.
+
+    menu.plug(Y.Plugin.NodeMenuNav);
+
+    &#x2F;&#x2F;  Show the menu now that it is ready
+
+    menu.get(&quot;ownerDocument&quot;).get(&quot;documentElement&quot;).removeClass(&quot;yui3-loading&quot;);
+
+});</pre>
+
+<em>Note:</em> In keeping with the
+<a href="http://developer.yahoo.com/performance/">Exceptional Performance</a>
+team's recommendation, the script block used to instantiate the menu will be
+<a href="http://developer.yahoo.com/performance/rules.html#js_bottom">placed at the bottom of the page</a>.
+This not only improves performance, it helps ensure that the DOM subtree of the
+element representing the root menu
+(<code>&#60;div id="productsandservices"&#62;</code>) is ready to be scripted.
+</p>
+
+<h2>Create the Rounded Corner Background Image</h2>
+<p>
+For performance, each rounded corner <code>&#60;div&#62;</code> uses the same image as its
+background image, but only reveals the relevant section of the image via the
+<code>background-position</code> property.  The complete image is as follows:
+</p>
+
+<img src="../assets/node-menunav/round.png" width="200" height="6" alt="Image used as the background image for the DIV elements used to create rounded corners">
+
+<h2>Styling the Rounded Corner HTML</h2>
+<p>
+With the rounded corner elements appended to each submenu, the next step is to define
+the styles that create the rounded corner effect.  Start by overriding the values for
+<code>border</code> and <code>padding</code> specified for the content box of each submenu in the
+Sam skin CSS.  The top and bottom borders are set to 0, since both borders will be drawn by the
+background image used to create the rounded corners.  The top and bottom padding will be created by
+setting the height of each <code>&#60;div&#62;</code> inside the
+<code>&#60;div class="yui3-menu-corner"&#62;</code>.
+</p>
+
+<pre class="code prettyprint">&#x2F;*
+    Overide the values for border and padding specified for the content box of each submenu in
+    the Sam skin CSS.  The top and bottom borders are set to 0, since both borders will be drawn
+    by the background image used to create the rounded corners.  The top and bottom padding
+    will be created by setting the height of each &lt;div&gt; inside the
+    &lt;div class=&quot;yui3-menu-corner&quot;&gt;.
+*&#x2F;
+
+#productsandservices .yui3-menu .yui3-menu-content {
+
+    border-top: 0;
+    border-bottom: 0;
+    padding: 0;
+
+}</pre>
+
+
+<p>
+Next, define the styles for each corner element.  The <code>&#60;div&#62;</code>s for the top-left
+and bottom-left corners define a right margin that will provide space for the their inner
+<code>&#60;div&#62;</code>s to fill using a negative right margin.  Each inner
+<code>&#60;div&#62;</code> will define a left margin to reveal the background image applied to
+its parent <code>&#60;div&#62;</code>.
+</p>
+<pre class="code prettyprint">.yui3-menu-corner {
+
+    margin-right: 4px;  &#x2F;*  Reserve space for the top-right and bottom-right corners. *&#x2F;
+
+    &#x2F;* The background image (sprite) for the top-left and bottom-left corners. *&#x2F;
+    background: url(..&#x2F;assets&#x2F;node-menunav&#x2F;round.png) no-repeat;
+
+}
+
+.yui3-menu-corner div {
+
+    height: 4px;
+
+    margin: 0 -4px 0 4px;   &#x2F;*  Use a negative right margin to move the &lt;div&gt; into
+                                the right margin of the parent element
+                                (&lt;div class=&quot;yui3-menu-corner&quot;&gt;) to draw the top-right
+                                and bottom-right corners.
+
+                                Apply a left margin to reveal the background image
+                                applied to the parent element for the top-left and
+                                bottom-left corners. *&#x2F;
+
+    &#x2F;* The background image (sprite) for the top-right and bottom-right corners. *&#x2F;
+    background: url(..&#x2F;assets&#x2F;node-menunav&#x2F;round.png) no-repeat;
+
+    _position: relative;    &#x2F;*  Necessary to get negative margins working in IE 6
+                                (Standards Mode and Quirks Mode and IE 7 (Quirks
+                                Mode only). *&#x2F;
+
+    _font-size: 0;  &#x2F;*  Necessary to collapse the height of the &lt;div&gt; in IE 6
+                        (Standards Mode and Quirks Mode and IE 7 (Quirks Mode only) so
+                        that it renders at 4px tall.  *&#x2F;
+
+}</pre>
+
+
+<p>
+The last step is to simply set <code>background-position</code> property for the bottom-left,
+top-right, and bottom-right corner elements to reveal the corresponding section of the corner
+background image.
+</p>
+<pre class="code prettyprint">&#x2F;*
+    Set the &quot;background-position&quot; property for the bottom-left, top-right, and
+    bottom-right corner elements to reveal the corresponding section of the corner
+    background image.
+*&#x2F;
+
+.yui3-menu-corner-bl {
+
+    background-position: left bottom;
+
+}
+
+.yui3-menu-corner .yui3-menu-corner-tr {
+
+    background-position: top right;
+
+}
+
+.yui3-menu-corner .yui3-menu-corner-br {
+
+    background-position: right bottom;
+
+}</pre>
+
+</div>
+            </div>
+        </div>
+
+        <div class="yui3-u-1-4">
+            <div class="sidebar">
+                
+
+                
+                    <div class="sidebox">
+                        <div class="hd">
+                            <h2 class="no-toc">Examples</h2>
+                        </div>
+
+                        <div class="bd">
+                            <ul class="examples">
+                                
+                                    
+                                        <li data-description="Creating left navigation using the MenuNav Node Plugin.">
+                                            <a href="menunav-leftnav.html">Basic Left Nav</a>
+                                        </li>
+                                    
+                                
+                                    
+                                        <li data-description="Creating top navigation using the MenuNav Node Plugin">
+                                            <a href="node-menunav-2.html">Basic Top Nav</a>
+                                        </li>
+                                    
+                                
+                                    
+                                        <li data-description="Creating menu button navigation using the MenuNav Node Plugin">
+                                            <a href="node-menunav-3.html">Menu Button Top Nav</a>
+                                        </li>
+                                    
+                                
+                                    
+                                        <li data-description="Creating split button navigation using the MenuNav Node Plugin">
+                                            <a href="node-menunav-4.html">Split Button Top Nav</a>
+                                        </li>
+                                    
+                                
+                                    
+                                        <li data-description="Adding shadows to submenus of a left nav using the MenuNav Node Plugin">
+                                            <a href="node-menunav-5.html">Left Nav with Submenus with Shadows</a>
+                                        </li>
+                                    
+                                
+                                    
+                                        <li data-description="Adding rounded corners to submenus of a left nav using the MenuNav Node Plugin">
+                                            <a href="node-menunav-6.html">Left Nav With Submenus With Rounded Corners</a>
+                                        </li>
+                                    
+                                
+                                    
+                                        <li data-description="Skining a menu built using the MenuNav Node Plugin to look like the menus on Flickr">
+                                            <a href="node-menunav-7.html">Skinning Menus Created Using the MenuNav Node Plugin</a>
+                                        </li>
+                                    
+                                
+                            </ul>
+                        </div>
+                    </div>
+                
+
+                
+            </div>
+        </div>
+    </div>
+</div>
+
+<script src="../assets/vendor/prettify/prettify-min.js"></script>
+<script>prettyPrint();</script>
+
+<script>
+YUI.Env.Tests = {
+    examples: [],
+    project: '../assets',
+    assets: '../assets/node-menunav',
+    name: 'node-menunav-6',
+    title: 'Left Nav With Submenus With Rounded Corners',
+    newWindow: 'true',
+    auto:  false 
+};
+YUI.Env.Tests.examples.push('menunav-leftnav');
+YUI.Env.Tests.examples.push('node-menunav-2');
+YUI.Env.Tests.examples.push('node-menunav-3');
+YUI.Env.Tests.examples.push('node-menunav-4');
+YUI.Env.Tests.examples.push('node-menunav-5');
+YUI.Env.Tests.examples.push('node-menunav-6');
+YUI.Env.Tests.examples.push('node-menunav-7');
+
+</script>
+<script src="../assets/yui/test-runner.js"></script>
+
+
+
+</body>
+</html>