Skip to content

Commit

Permalink
Project files added
Browse files Browse the repository at this point in the history
  • Loading branch information
Catalin Rosu committed Feb 22, 2013
0 parents commit 3432e24
Show file tree
Hide file tree
Showing 6 changed files with 624 additions and 0 deletions.
24 changes: 24 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Animenu - a responsive dropdown navigation made with SCSS #

[red-team-design.com](http://www.red-team-design.com/)

## Browser compatibility ##

Animenu works in all major browsers. IE8+.

## License ##

Public domain: [http://unlicense.org](http://unlicense.org)
54 changes: 54 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Animenu - a responsive dropdown navigation made with SCSS</title>
<link rel="stylesheet" href="stylesheets/style.css">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2pre/html5shiv.js"></script>
<![endif]-->
</head>
<body>

<nav class="animenu">
<input type="checkbox" id="button">
<label for="button">Menu</label>
<ul>
<li>
<a href="#">Item 1</a>
<ul>
<li><a href="">Sub Item 1</a></li>
<li><a href="">Sub Item 2</a></li>
<li><a href="">Sub Item 3</a></li>
</ul>
</li>
<li>
<a href="#">Item 2</a>
<ul>
<li><a href="">Sub Item 1</a></li>
<li><a href="">Sub Item 2</a></li>
<li><a href="">Sub Item 3</a></li>
</ul>
</li>
<li>
<a href="#">Item 3</a>
<ul>
<li><a href="">Sub Item 1</a></li>
<li><a href="">Sub Item 2</a></li>
<li><a href="">Sub Item 3</a></li>
</ul>
</li>
<li>
<a href="#">Item 4</a>
<ul>
<li><a href="">Sub Item 1</a></li>
<li><a href="">Sub Item 2</a></li>
<li><a href="">Sub Item 3</a></li>
</ul>
</li>
</ul>
</nav>

</body>
</html>
114 changes: 114 additions & 0 deletions sass/_responsive.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
@media screen and (max-width: 480px) {

%revert-list {
visibility: visible;
opacity: 1;
display: none;
}

.animenu {
#{$input}:checked ~ label,
#{$input} ~ label:hover, {
color: lighten($baseMenuColor, 80%);
}
label {
border: 1px solid darken($baseMenuBackground, 5%);
@include menu-background($baseMenuBackground);
@include box-shadow(0 1px 0 rgba(255, 255, 255, .2) inset);
color: $baseMenuColor;
@include text-shadow(0 1px 0 $baseMenuBackground);
@include border-radius(3px);
text-transform: uppercase;
position:relative;
display:block;
padding: $gutter 3 * $gutter;
&:before {
position: absolute;
left: $gutter / 2;
top: $gutter / 5;
content: "\2261";
font-size: 2em;
}
}
// First level -> main menu items
// <nav class="animenu">
// <ul></ul>
// </nav>
> ul {
position: relative;
border-color: $baseMenuBackground;
margin: $gutter / 2 0 !important;
padding: $gutter / 4;
@include box-shadow(none);
@include menu-background($baseMenuBackground, false);
@include pseudo-triangle(6px, 2);
@extend %revert-list;
li {
display: block;
}
> li {
float: none;
border: 0;
@include box-shadow(none);
@include menu-background($baseMenuBackground, false);
> a {
float: none;
display: block;
padding: $gutter;
}
}
// Second level
// <nav class="animenu">
// <ul>
// <ul></ul>
// </ul>
// </nav>
ul {
position: static;
@include border-radius(0);
@include menu-background(lighten($baseMenuBackground, 10%), false);
margin: 0;
@extend %revert-list;
@include transition-property("none");
li {
&:first-child > a {
@include border-radius(0);
&:after {
content: none;
}
}
&:last-child > a {
@include border-radius(0);
}
}
a {
padding-left: 2 * $gutter;
display: block;
width: auto;
}
} // end second level
} // end first level
#{$input}:checked {
~ ul {
display: block;
ul {
display: block;
}
}
} // end #{$input}:checked
} // end .animenu

} //end @media


// Adjust menu when resizing [in this case].
// To be updated depending of menu items length.
@media screen and (max-width: 600px) {
.animenu > ul {
> li {
> a {
padding: $gutter 2 * $gutter;
}
}
}
}
153 changes: 153 additions & 0 deletions sass/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
@import "compass/css3";

// Variables
$subMenuItemWidth: 175px; // Minimum width for submenus' items
$baseMenuBackground: #111; // Base color theme
$secondaryMenuBackground: #0186ba; // Secondary color (highlights, triangles...)
$baseMenuColor: #999; // Proper menu items color
$gutter: 1em; // Base gutter
$input: "input[type=checkbox]"; // Checkbox hack selector

// Menu background mixin
@mixin menu-background($color, $menu-gradient: true) {
background-color: $color;
@if $menu-gradient == true {
@include background-image(linear-gradient(rgba(255, 255, 255, .2),
rgba(255, 255, 255, 0)));
}
@else {
background-image: none;
}
}

// Menu background mixin
// The $size argument specifies the actual size of the triangle
// The $shift-left helps on horizontal positioning.
@mixin pseudo-triangle($size, $shift-left) {
&:after {
content: '';
position: absolute;
left: $shift-left * $gutter;
top: -$size * 2;
border: $size solid transparent;
border-bottom-color: inherit;
}
}

// Shortest clearfix. Ever. IE8+.
// http://www.css-101.org/articles/clearfix/latest-new-clearfix-so-far.php
%cf:after {
content:"";
display:table;
clear:both;
}

// New box model, small reset, global stuff
.animenu {
font: bold 13px Arial, Helvetica;
* {
@include box-sizing(border-box);
}
ul {
margin: 0;
padding: 0;
list-style: none;
@include border-radius(3px);
}
li {
position: relative;
&:hover {
> ul {
opacity: 1;
visibility: visible;
margin: 0;
}
> a {
color: lighten($baseMenuColor, 80%);
}
}
}
#{$input} {
position: absolute;
top: -9999px;
left: -9999px;
}
label {
display:none;
cursor: pointer;
user-select:none;
}
}

// First level -> main menu items
// <nav class="animenu">
// <ul></ul>
// </nav>
.animenu > ul {
border: 1px solid darken($baseMenuBackground, 5%);
@include menu-background($baseMenuBackground);
@include box-shadow(0 1px 0 rgba(255, 255, 255, .2) inset);
@extend %cf;
> li {
float: left;
border-right: 1px solid lighten($baseMenuBackground, 5%);
@include box-shadow(1px 0 0 lighten($baseMenuBackground, 20%));
> a {
float: left;
padding: $gutter 3 * $gutter;
text-transform: uppercase;
}
}
a {
color: $baseMenuColor;
text-decoration: none;
@include text-shadow(0 1px 0 $baseMenuBackground);
}

// Second level
// <nav class="animenu">
// <ul>
// <ul></ul>
// </ul>
// </nav>
ul {
position: absolute;
top: 100%; left: 0;
z-index: 1;
opacity: 0;
visibility: hidden;
margin: 2 * $gutter 0 0 0;
@include menu-background(lighten($baseMenuBackground, 15%), false);
@include transition-property("margin, opacity");
@include transition-duration(".15s");
@include transition-timing-function(ease-in-out);
li {
display: block;
@include box-shadow(0 1px 0 lighten($baseMenuBackground, 5%),
0 2px 0 lighten($baseMenuBackground, 25%));
&:first-child > a {
@include border-radius(3px 3px 0 0);
@include pseudo-triangle(6px, 4);
}
&:last-child {
@include box-shadow(none);
> a {
@include border-radius(0 0 3px 3px);
}
}
}
a {
padding: $gutter;
width: $subMenuItemWidth;
display: block;
border-color: lighten($baseMenuBackground, 15%);
&:hover {
background-color: $secondaryMenuBackground;
border-color: $secondaryMenuBackground;
}
}
}
}

// Last but not least: the responsive stuff
@import "responsive";
Loading

0 comments on commit 3432e24

Please sign in to comment.