Last active
July 5, 2019 09:21
-
-
Save k-ish/8e5c7394f6d62ac46d396a9b513be060 to your computer and use it in GitHub Desktop.
オーバーレイメニュー
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<link rel="stylesheet" href="style.css" media="all"> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> | |
<script src="script.js"></script> | |
</head> | |
<body> | |
<nav> | |
<ul> | |
<li><a href="https://facebook.com">Company</a></li> | |
<li><a href="#">Services</a></li> | |
<li><a href="#">Social</a></li> | |
<li><a href="#">Contact</a></li> | |
</ul> | |
</nav> | |
<div class="menu-btn"> | |
<a class="btn-open" href="javascript:void(0)"></a> | |
</div> | |
<div class="overlay"> | |
<div class="menu"> | |
<ul> | |
<li><a href="#">About</a> | |
<ul> | |
<li><a href="#">About Company</a></li> | |
<li><a href="#">Designers</a></li> | |
<li><a href="#">Developers</a></li> | |
</ul> | |
</li> | |
<li><a href="#">Services</a> | |
<ul> | |
<li><a href="#">Web design</a></li> | |
<li><a href="#">Development</a></li> | |
<li><a href="#">Apps</a></li> | |
<li><a href="#">Graphic Design</a></li> | |
<li><a href="#">Seo</a></li> | |
</ul> | |
</li> | |
<li><a href="#">Work</a> | |
<ul> | |
<li><a href="#">Web</a></li> | |
<li><a href="#">Graphics</a></li> | |
<li><a href="#">Apps</a></li> | |
<li><a href="#">Seo</a></li> | |
</ul> | |
</li> | |
<li><a href="#">Social</a> | |
<ul> | |
<li><a href="#">Facebook</a></li> | |
<li><a href="#">Twitter</a></li> | |
<li><a href="#">Codepen</a></li> | |
<li><a href="#">Behance</a></li> | |
<li><a href="#">Dribbble</a></li> | |
</ul> | |
</li> | |
</ul> | |
</div> | |
</div> | |
<h4>Example #2 - Full menu with second menu</h4> | |
<!-- Github button --> | |
<a href="https://github.com/marioloncarek/responsive-overlay-menu" target="_blank"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://camo.githubusercontent.com/567c3a48d796e2fc06ea80409cc9dd82bf714434/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f6461726b626c75655f3132313632312e706e67" | |
alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png"></a> | |
<a href="https://codepen.io/collection/ANqMpL/" target="_blank"><div class="allexamples">View all examples</div></a> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
$(".menu-btn a").click(function () { | |
$(".overlay").fadeToggle(200); | |
$(this).toggleClass('btn-open').toggleClass('btn-close'); | |
}); | |
$('.overlay').on('click', function () { | |
$(".overlay").fadeToggle(200); | |
$(".menu-btn a").toggleClass('btn-open').toggleClass('btn-close'); | |
}); | |
$('.menu a').on('click', function () { | |
$(".overlay").fadeToggle(200); | |
$(".menu-btn a").toggleClass('btn-open').toggleClass('btn-close'); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
- Name: Responsive overlay menu framework | |
- Version: 1.0 | |
- Latest update: 15.9.2015. | |
- Author: Mario Loncarek | |
- Author web site: http://marioloncarek.com | |
*/ | |
body, | |
html { | |
margin: 0; | |
padding: 0; | |
width: 100%; | |
height: 100%; | |
font-family: 'Raleway', sans-serif; | |
} | |
h3 { | |
color: #e9e9e9; | |
text-align: center; | |
margin: 0; | |
padding: 10px 0 0; | |
} | |
h4 { | |
color: #333; | |
text-align: center; | |
margin: 0; | |
padding: 10px 0 0; | |
} | |
a { | |
text-decoration: none; | |
-webkit-transition: all .3s ease; | |
-moz-transition: all .3s ease; | |
-ms-transition: all .3s ease; | |
-o-transition: all .3s ease; | |
transition: all .3s ease; | |
} | |
/* OUTER NAV */ | |
nav { | |
position: relative; | |
overflow: hidden; | |
width: 100%; | |
height: auto; | |
background: none; | |
text-align: center; | |
} | |
nav ul { | |
text-align: center; | |
} | |
nav ul li { | |
display: inline-block; | |
} | |
nav ul li a { | |
display: inline-block; | |
padding: 1em 3em; | |
border-bottom: 2px solid #fff; | |
color: #333; | |
text-decoration: none; | |
font-size: 16px; | |
-webkit-transition: all .2s linear 0s; | |
-moz-transition: all .2s linear 0s; | |
-o-transition: all .2s linear 0s; | |
transition-property: all .2s linear 0s; | |
} | |
nav ul li a:hover { | |
color: #34B484; | |
} | |
/* OPEN / CLOSE BTNS */ | |
.menu-btn { | |
position: absolute; | |
top: 6px; | |
right: 20px; | |
z-index: 999; | |
display: inline; | |
font-size: 32px; | |
} | |
.menu-btn a { | |
display: inline-block; | |
text-decoration: none; | |
/* safari hack */ | |
} | |
.btn-open:after { | |
color: #333; | |
content: "\f394"; | |
font-family: "Ionicons"; | |
-webkit-transition: all .2s linear 0s; | |
-moz-transition: all .2s linear 0s; | |
-o-transition: all .2s linear 0s; | |
transition-property: all .2s linear 0s; | |
} | |
.btn-open:hover:after { | |
color: #34B484; | |
} | |
.btn-close:after { | |
color: #fff; | |
content: "\f2d7"; | |
font-family: "Ionicons"; | |
-webkit-transition: all .2s linear 0s; | |
-moz-transition: all .2s linear 0s; | |
-o-transition: all .2s linear 0s; | |
transition-property: all .2s linear 0s; | |
} | |
.btn-close:hover:after { | |
color: #34B484; | |
} | |
/* OVERLAY */ | |
.overlay { | |
position: fixed; | |
top: 0; | |
z-index: 99; | |
display: none; | |
overflow: auto; | |
width: 100%; | |
height: 100%; | |
background: #333; | |
} | |
.overlay .menu { | |
margin: 10% auto; | |
width: 80%; | |
} | |
.overlay .menu ul { | |
margin: 0; | |
padding: 0; | |
width: 100%; | |
} | |
.overlay .menu ul li { | |
float: left; | |
padding: 20px 0; | |
width: 25%; | |
list-style: none; | |
text-align: center; | |
text-transform: uppercase; | |
} | |
.overlay .menu ul li a { | |
color: #34B484; | |
font-weight: bold; | |
font-size: 20px; | |
} | |
.overlay .menu ul ul { | |
margin-top: 50px; | |
} | |
.overlay .menu ul ul li { | |
position: relative; | |
float: none; | |
margin: 0; | |
width: 100%; | |
border: 0; | |
} | |
.overlay .menu ul ul li a { | |
color: #fff; | |
text-transform: capitalize; | |
font-weight: bold; | |
font-size: 14px; | |
} | |
.overlay .menu ul ul li a:hover { | |
color: #34b484; | |
} | |
/* RESPONSIVE */ | |
@media screen and (max-width: 768px) { | |
nav { | |
display: none; | |
} | |
.overlay .menu ul li { | |
float: none; | |
margin-bottom: 50px; | |
width: 100%; | |
border-bottom: 1px solid #575757; | |
} | |
.overlay .menu ul li:last-child { | |
border: 0; | |
} | |
.overlay .menu ul ul { | |
margin-top: 20px; | |
} | |
.menu-btn { | |
right: 25px; | |
} | |
} | |
.allexamples{ | |
position:absolute; | |
bottom:0; | |
font-size:18px; | |
font-weight:bold; | |
width:100%; | |
text-align:center; | |
background:#e9e9e9; | |
padding:20px; | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
color:#333; | |
position:fixed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment