[パーツ]フルスクリーンメニュー 左のメニューをクリックすると出てくるフルスクリーンメニュー

CSS HTML
 2018.07.09

左のメニューをクリックすると出てくるフルスクリーンメニュー

フルスクリーンメニューのシンプルなバージョンです。
フルスクリーン内のテキストは上から順に表示されます。

browser:  65 11 20 
ニャン易度 
<div class="contents">
	<h1>Contents</h1>
	<p>コンテンツ</p>
</div>
<div class="cp_fullscreenmenu">
	<input class="toggle" type="checkbox" />
	<div class="hamburger"><span></span></div>
	<div class="menu">
		<div>
		<ul>
		<li><a href="#">About</a></li>
		<li><a href="#">Products</a></li>
		<li><a href="#">Blog</a></li>
		<li><a href="#">Contact</a></li>
		</ul>
		</div>
	</div>
</div>
* {
	-webkit-box-sizing: border-box;
	        box-sizing: border-box;
}
a,
a:visited,
a:hover,
a:active {
	text-decoration: none;
	color: inherit;
}
.cp_fullscreenmenu {
	position: fixed;
	z-index: 1;
	top: 0;
	left: 0;
}
/*menuコンテンツ*/
.cp_fullscreenmenu .menu {
	position: fixed;
	top: 0;
	left: 0;
	display: flex;
	visibility: hidden;
	overflow: hidden;
	width: 100%;
	height: 100%;
	pointer-events: none;
	outline: 1px solid transparent;

	-webkit-backface-visibility: hidden;
	        backface-visibility: hidden;
	align-items: center;
	justify-content: center;
}
.cp_fullscreenmenu .menu > div {
	display: flex;
	overflow: hidden;
	width: 200vw;
	height: 200vw;
	transition: all 0.4s ease;
	-webkit-transform: scale(0);
	        transform: scale(0);
	text-align: center;
	color: #fefefe;
	border-radius: 50%;
	background: rgba(0,131,143 ,0.8);

	flex: none;
	-webkit-backface-visibility: hidden;
	        backface-visibility: hidden;
	align-items: center;
	justify-content: center;
}
.cp_fullscreenmenu .menu > div > ul {
	display: block;
	max-height: 100vh;
	margin: 0;
	padding: 0 1em;
	list-style: none;
	transition: opacity 0.4s ease;
	opacity: 0;
}
.cp_fullscreenmenu .menu > div > ul > li {
	font-size: 24px;
	display: block;
	margin: 1em;
	padding: 0;
}
.cp_fullscreenmenu .menu > div > ul > li > a {
	position: relative;
	display: inline;
	cursor: pointer;
	transition: color 0.4s ease;
}
.cp_fullscreenmenu .menu > div > ul > li > a:hover {
	color: #e5e5e5;
}
.cp_fullscreenmenu .menu > div > ul > li > a:hover:after {
	width: 100%;
}
.cp_fullscreenmenu .menu > div > ul > li > a:after {
	position: absolute;
	z-index: 1;
	bottom: -0.15em;
	left: 0;
	width: 0;
	height: 2px;
	content: '';
	transition: width 0.4s ease;
	background: #e5e5e5;
}
/*クリックしたらメニューが開閉の動作*/
.cp_fullscreenmenu .toggle {
	position: absolute;
	z-index: 2;
	top: 0;
	left: 0;
	width: 60px;
	height: 60px;
	cursor: pointer;
	opacity: 0;
}
.cp_fullscreenmenu .toggle:checked + .hamburger > span {
	-webkit-transform: rotate(135deg);
	        transform: rotate(135deg);
}
.cp_fullscreenmenu .toggle:checked + .hamburger > span:before,
.cp_fullscreenmenu .toggle:checked + .hamburger > span:after {
	top: 0;
	-webkit-transform: rotate(90deg);
	        transform: rotate(90deg);
}
.cp_fullscreenmenu .toggle:checked + .hamburger > span:after {
	opacity: 0;
}
.cp_fullscreenmenu .toggle:checked ~ .menu {
	visibility: visible;
	pointer-events: auto;
}
.cp_fullscreenmenu .toggle:checked ~ .menu > div {
	transition-duration: 0.75s;
	-webkit-transform: scale(1);
	        transform: scale(1);
}
.cp_fullscreenmenu .toggle:checked ~ .menu > div > ul {
	opacity: 1;
}
.cp_fullscreenmenu .toggle:checked ~ .menu > div > ul li:nth-of-type(1) {
	transition-delay: 0.4s;
}
.cp_fullscreenmenu .toggle:checked ~ .menu > div > ul li:nth-of-type(2) {
	transition-delay: 0.6s;
}
.cp_fullscreenmenu .toggle:checked ~ .menu > div > ul li:nth-of-type(3) {
	transition-delay: 0.8s;
}
.cp_fullscreenmenu .toggle:checked ~ .menu > div > ul li:nth-of-type(4) {
	transition-delay: 1.0s;
}
.cp_fullscreenmenu .toggle:hover + .hamburger {
	box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}
.cp_fullscreenmenu .toggle:checked:hover + .hamburger > span {
	-webkit-transform: rotate(225deg);
	        transform: rotate(225deg);
}
/*ハンバーガー*/
.cp_fullscreenmenu .hamburger {
	position: absolute;
	z-index: 1;
	top: 0;
	left: 0;
	display: block;
	width: 60px;
	height: 60px;
	padding: 0.5em 1em;
	cursor: pointer;
	transition: box-shadow 0.4s ease;
	border-radius: 0 0.12em 0.12em 0;
	background: rgba(0,151,167 ,0.7);

	-webkit-backface-visibility: hidden;
	        backface-visibility: hidden;
}
.cp_fullscreenmenu .hamburger > span {
	position: relative;
	top: 50%;
	display: block;
	width: 100%;
	height: 2px;
	transition: all 0.4s ease;
	background: #fefefe;
}
.cp_fullscreenmenu .hamburger > span:before,
.cp_fullscreenmenu .hamburger > span:after {
	position: absolute;
	z-index: 1;
	top: -10px;
	left: 0;
	display: block;
	width: 100%;
	height: 2px;
	content: '';
	transition: all 0.4s ease;
	background: inherit;
}
.cp_fullscreenmenu .hamburger > span:after {
	top: 10px;
}

copypet.jp

CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。

More Info

こんな記事はいかがですか?