1. David Lin
  2. side-menu

Commits

David Lin  committed 2881145

prototype #2

  • Participants
  • Parent commits 52a402e
  • Branches master

Comments (0)

Files changed (3)

File menu-action.js

View file
  • Ignore whitespace
 jQuery(document).on("ready", function(){
-  jQuery(".side-navigation > ul > li > a").click(function(){
+  jQuery(".side-navigation > a").click(function(){
     jQuery(this).parent().toggleClass("active");
   });
 });

File menu-style.css

View file
  • Ignore whitespace
-
 .side-navigation {
-  width: 12em;
+  width: 20em;
+  font-family: "微軟正黑體", Arial, Helvetica, sans-serif;
+  
+  margin-bottom: 0em;
+  padding: 0 0 .5em 0;
   border-right: 1px solid #000;
-	padding: 0 0 1em 0;
-	margin-bottom: 1em;
-	font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, sans-serif;
-	background-color: #90bade;
-	color: #333;
+  color: #333;
+  background-color: #90bade;
 }
 
 .side-navigation ul {
   list-style: none;
-	margin: 0;
-	padding: 0;
-	border: none;
+  margin: .2em;
+  padding-left: 1em;
 }
 
 .side-navigation li {
-	border-bottom: 1px solid #90bade;
-	margin: 0;
-	list-style: none;
-	list-style-image: none;
+  padding-top: 1px;
+  margin: 0;
+  list-style: none;
+  list-style-image: none;
+  border-bottom: 1px solid #90bade;
 }
 
-.side-navigation li span,a {
-	display: block;
-	padding: 5px 5px 5px 0.5em;
-	border-left: 10px solid #1958b7;
-	border-right: 10px solid #508fc4;
-	background-color: #2175bc;
-	color: #fff;
-	text-decoration: none;
-	width: 100%;
+.side-navigation a {
+  color: #fff;
+  padding: 5px 5px 5px 0.5em;
+  border-left: 10px solid #1958b7;
+  border-right: 10px solid #508fc4;
+  background-color: #2175bc;
+  position: relative;
+  display: block;
+  text-decoration: none;
 }
 
-html>body .side-navigation a,span {
-	width: auto;
+.side-navigation a:hover {
+  color: #FFF;
+  border-left: 10px solid #1c64d1;
+  border-right: 10px solid #5ba3e0;
+  background-color: #2586d7;
 }
 
-html>body .side-navigation > ul > li > ul {
-	display: block;
-  padding-left: 1em;
+.side-navigation > a {
+  font-weight: bold;
+  background-color: #2080d0;
+}
+
+.side-navigation > ul {
+  display: none;
   opacity: 0;
-  height: 0;
-  
-  transition: opacity 0.5s ease-out;
-  -moz-transition: opacity 0.5s ease-out;
-  -webkit-transition: opacity 0.5s ease-out;
-  -o-transition: opacity 0.5s ease-out;
+  transition: opacity .5s ease;
+  -webkit-transition: opacity .5s ease;
 }
 
-html>body .side-navigation > ul > li.active > ul {
-	display: block;
+.side-navigation.active > ul {
+  display: block;
   opacity: 1;
-  height: auto;
 }

File menu.html

View file
  • Ignore whitespace
     <script src="menu-action.js"></script>
   </head>
   <body>
+    
     <div class="side-navigation">
+      <a href="#">About</a>
       <ul>
-        <li><a href="#">さようなら</a></li>
-        <li><a href="#">こんにちは</a></li>
-        <li><a href="#">まさきこう</a></li>
-        <li>
-          <a href="#">くうこう</a>
-          <ul>
-            <li><a href="#">やまざき</a></li>
-            <li><a href="#">おおさか</a></li>
-          </ul>
-        </li>
-        <li>
-          <a href="#">くうこう</a>
-          <ul>
-            <li><a href="#">やまざき</a></li>
-            <li><a href="#">おおさか</a></li>
-          </ul>
-        </li>
-        <li>
-          <a href="#">くうこう</a>
-          <ul>
-            <li><a href="#">やまざき</a></li>
-            <li><a href="#">おおさか</a></li>
-          </ul>
-        </li>
+        <li><a href="#">ABC</a></li>
+        <li><a href="#">ABC</a></li>
+        <li><a href="#">ABC</a></li>
       </ul>
     </div>
+    
+    <div class="side-navigation">
+      <a href="#">About</a>
+      <ul>
+        <li><a href="#">ABC</a></li>
+        <li><a href="#">ABC</a></li>
+        <li><a href="#">ABC</a></li>
+      </ul>
+    </div>
+    
   </body>
 </html>