
メガメニューの表示アニメーションを実装したい……



大型サイトのナビゲーション効果を作りたい……
今回はこのようなお悩みをお持ちの方へ向けて
Web制作において人気の高いアニメーション効果
メガメニュー表示アニメーション
をご紹介します。
- フェード(透明度変化による表示)
- スライド(方向性のあるスライド表示)
- カスケード(段階的な表示)
- グリッド(グリッド状の表示)
- カラム(カラム形式の表示)
- カード(カード形式の表示)



特に大型サイトやECサイトには、メガメニュー表示アニメーションが非常に効果的です。この記事のコードをご活用いただきWeb制作の効率化に繋がれば何よりです。
なお、今回ご紹介するアニメーションはCSSのみで実装するので、JavaScriptが不要で軽量なインタラクションを実現できます。
あわせて読みたい
メガメニュー表示アニメーションとは
メガメニュー表示アニメーションは、大型のメニューが表示される際の視覚的な効果です。ユーザーの注目を集め、スムーズなインタラクションを提供するための手法です。
効果的な使用場面
適している場面
- 大型サイト
- ECサイト
- 企業サイト
- ポータルサイト
- 複雑なナビゲーション
避けるべき場面
- モバイルサイト
- シンプルなサイト
- アクセシビリティを重視する場面
- 過度に使用した場合
実装方法の比較
アニメーション | 難易度 | 視覚的インパクト | パフォーマンス | ブラウザ対応 |
---|---|---|---|---|
フェード | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
スライド | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
カスケード | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
グリッド | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
カラム | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
カード | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐ |
フェード
① デモ
See the Pen メガメニューフェード by ケケンタ (@lgshifbg-the-looper) on CodePen.
- 透明度変化による表示
- スムーズな効果
- 視覚的インパクト小
- エレガントな印象
② HTML
<nav class="mega-menu-container">
<ul class="nav-list">
<li class="nav-item">
<a href="#" class="nav-link">商品カテゴリ</a>
<div class="mega-menu fade">
<div class="mega-menu-content">
<div class="mega-menu-section">
<h3>カテゴリ1</h3>
<ul>
<li><a href="#">商品A</a></li>
<li><a href="#">商品B</a></li>
<li><a href="#">商品C</a></li>
</ul>
</div>
<div class="mega-menu-section">
<h3>カテゴリ2</h3>
<ul>
<li><a href="#">商品D</a></li>
<li><a href="#">商品E</a></li>
<li><a href="#">商品F</a></li>
</ul>
</div>
<div class="mega-menu-section">
<h3>カテゴリ3</h3>
<ul>
<li><a href="#">商品G</a></li>
<li><a href="#">商品H</a></li>
<li><a href="#">商品I</a></li>
</ul>
</div>
</div>
</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">サービス</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">会社概要</a>
</li>
</ul>
</nav>
③ CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
}
.mega-menu-container {
background: #667eea;
padding: 0 20px;
}
.nav-list {
list-style: none;
display: flex;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.nav-link {
display: block;
padding: 20px 15px;
color: white;
text-decoration: none;
font-weight: 500;
transition: background-color 0.3s ease;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
}
.mega-menu {
position: absolute;
top: 64px;
left: 50%;
transform: translateX(-50%) translateY(-10px);
width: 100vw;
background: white;
border-top: 1px solid #e1e5e9;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
z-index: 1000;
}
.nav-item:hover .mega-menu {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(0);
}
.mega-menu-content {
display: flex;
padding: 30px;
gap: 40px;
max-width: 1200px;
margin: 0 auto;
}
.mega-menu-section {
flex: 1;
}
.mega-menu-section h3 {
color: #333;
font-size: 18px;
margin-bottom: 15px;
font-weight: 600;
}
.mega-menu-section ul {
list-style: none;
}
.mega-menu-section li {
margin: 8px 0;
}
.mega-menu-section a {
color: #666;
text-decoration: none;
font-size: 14px;
transition: color 0.2s ease;
}
.mega-menu-section a:hover {
color: #667eea;
}
④ カスタマイズ例
/* フェード速度の変更 */
.mega-menu {
transition: all 0.5s ease;
}
/* フェード方向の変更 */
.mega-menu {
transform: translateX(-50%) translateY(-20px);
}
/* フェード色の変更 */
.mega-menu {
background: #f8f9fa;
border-top-color: #667eea;
}
スライド
① デモ
See the Pen メガメニュースライド by ケケンタ (@lgshifbg-the-looper) on CodePen.
- 方向性のあるスライド表示
- 自然な動き
- 視覚的インパクト中
- 直感的な印象
② HTML
<nav class="mega-menu-container">
<ul class="nav-list">
<li class="nav-item">
<a href="#" class="nav-link">商品カテゴリ</a>
<div class="mega-menu slide">
<div class="mega-menu-content">
<div class="mega-menu-section">
<h3>カテゴリ1</h3>
<ul>
<li><a href="#">商品A</a></li>
<li><a href="#">商品B</a></li>
<li><a href="#">商品C</a></li>
</ul>
</div>
<div class="mega-menu-section">
<h3>カテゴリ2</h3>
<ul>
<li><a href="#">商品D</a></li>
<li><a href="#">商品E</a></li>
<li><a href="#">商品F</a></li>
</ul>
</div>
<div class="mega-menu-section">
<h3>カテゴリ3</h3>
<ul>
<li><a href="#">商品G</a></li>
<li><a href="#">商品H</a></li>
<li><a href="#">商品I</a></li>
</ul>
</div>
</div>
</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">サービス</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">会社概要</a>
</li>
</ul>
</nav>
③ CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
}
.mega-menu-container {
background: #667eea;
padding: 0 20px;
}
.nav-list {
list-style: none;
display: flex;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.nav-item {
position: relative;
}
.nav-link {
display: block;
padding: 20px 15px;
color: white;
text-decoration: none;
font-weight: 500;
transition: background-color 0.3s ease;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
}
.mega-menu {
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%) translateY(-20px);
width: 100vw;
background: white;
border-top: 1px solid #e1e5e9;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
opacity: 0;
visibility: hidden;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
z-index: 1000;
overflow: hidden;
}
.nav-item:hover .mega-menu {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(0);
}
.mega-menu-content {
display: flex;
padding: 30px;
gap: 40px;
max-width: 1200px;
margin: 0 auto;
}
.mega-menu-section {
flex: 1;
}
.mega-menu-section h3 {
color: #333;
font-size: 18px;
margin-bottom: 15px;
font-weight: 600;
}
.mega-menu-section ul {
list-style: none;
}
.mega-menu-section li {
margin: 8px 0;
}
.mega-menu-section a {
color: #666;
text-decoration: none;
font-size: 14px;
transition: color 0.2s ease;
}
.mega-menu-section a:hover {
color: #667eea;
}
④ カスタマイズ例
/* スライド距離の変更 */
.mega-menu {
transform: translateX(-50%) translateY(-30px);
}
/* スライド速度の変更 */
.mega-menu {
transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
/* スライド方向の変更 */
.mega-menu {
transform: translateX(-50%) translateY(-20px) scale(0.95);
}
.nav-item:hover .mega-menu {
transform: translateX(-50%) translateY(0) scale(1);
}
カスケード
① デモ
See the Pen メガメニューカスケード by ケケンタ (@lgshifbg-the-looper) on CodePen.
- 段階的な表示
- 動的な効果
- 視覚的インパクト大
- 洗練された印象
② HTML
<nav class="mega-menu-container">
<ul class="nav-list">
<li class="nav-item">
<a href="#" class="nav-link">商品カテゴリ</a>
<div class="mega-menu cascade">
<div class="mega-menu-content">
<div class="mega-menu-section">
<h3>カテゴリ1</h3>
<ul>
<li><a href="#">商品A</a></li>
<li><a href="#">商品B</a></li>
<li><a href="#">商品C</a></li>
</ul>
</div>
<div class="mega-menu-section">
<h3>カテゴリ2</h3>
<ul>
<li><a href="#">商品D</a></li>
<li><a href="#">商品E</a></li>
<li><a href="#">商品F</a></li>
</ul>
</div>
<div class="mega-menu-section">
<h3>カテゴリ3</h3>
<ul>
<li><a href="#">商品G</a></li>
<li><a href="#">商品H</a></li>
<li><a href="#">商品I</a></li>
</ul>
</div>
</div>
</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">サービス</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">会社概要</a>
</li>
</ul>
</nav>
③ CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
}
.mega-menu-container {
background: #667eea;
padding: 0 20px;
}
.nav-list {
list-style: none;
display: flex;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.nav-link {
display: block;
padding: 20px 15px;
color: white;
text-decoration: none;
font-weight: 500;
transition: background-color 0.3s ease;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
}
.mega-menu {
position: absolute;
top: 64px;
left: 50%;
transform: translateX(-50%) translateY(-10px);
width: 100vw;
background: white;
border-top: 1px solid #e1e5e9;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
z-index: 1000;
}
.nav-item:hover .mega-menu {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(0);
}
.mega-menu-content {
display: flex;
padding: 30px;
gap: 40px;
max-width: 1200px;
margin: 0 auto;
}
.mega-menu-section {
flex: 1;
opacity: 0;
transform: translateY(-10px);
transition: all 0.3s ease;
}
.nav-item:hover .mega-menu-section:nth-child(1) {
opacity: 1;
transform: translateY(0);
transition-delay: 0.1s;
}
.nav-item:hover .mega-menu-section:nth-child(2) {
opacity: 1;
transform: translateY(0);
transition-delay: 0.2s;
}
.nav-item:hover .mega-menu-section:nth-child(3) {
opacity: 1;
transform: translateY(0);
transition-delay: 0.3s;
}
.mega-menu-section h3 {
color: #333;
font-size: 18px;
margin-bottom: 15px;
font-weight: 600;
}
.mega-menu-section ul {
list-style: none;
}
.mega-menu-section li {
margin: 8px 0;
}
.mega-menu-section a {
color: #666;
text-decoration: none;
font-size: 14px;
transition: color 0.2s ease;
}
.mega-menu-section a:hover {
color: #667eea;
}
④ カスタマイズ例
/* カスケード速度の変更 */
.nav-item:hover .mega-menu-section:nth-child(1) {
transition-delay: 0.05s;
}
.nav-item:hover .mega-menu-section:nth-child(2) {
transition-delay: 0.1s;
}
.nav-item:hover .mega-menu-section:nth-child(3) {
transition-delay: 0.15s;
}
/* カスケード方向の変更 */
.mega-menu-section {
transform: translateX(-10px);
}
.nav-item:hover .mega-menu-section {
transform: translateX(0);
}
グリッド
① デモ
See the Pen メガメニューグリッド by ケケンタ (@lgshifbg-the-looper) on CodePen.
- グリッド状の表示
- 整然とした効果
- 視覚的インパクト大
- モダンな印象
② HTML
<nav class="mega-menu-container">
<ul class="nav-list">
<li class="nav-item">
<a href="#" class="nav-link">商品カテゴリ</a>
<div class="mega-menu grid">
<div class="mega-menu-content">
<div class="grid-container">
<div class="grid-item">
<h3>カテゴリ1</h3>
<ul>
<li><a href="#">商品A</a></li>
<li><a href="#">商品B</a></li>
<li><a href="#">商品C</a></li>
</ul>
</div>
<div class="grid-item">
<h3>カテゴリ2</h3>
<ul>
<li><a href="#">商品D</a></li>
<li><a href="#">商品E</a></li>
<li><a href="#">商品F</a></li>
</ul>
</div>
<div class="grid-item">
<h3>カテゴリ3</h3>
<ul>
<li><a href="#">商品G</a></li>
<li><a href="#">商品H</a></li>
<li><a href="#">商品I</a></li>
</ul>
</div>
<div class="grid-item">
<h3>カテゴリ4</h3>
<ul>
<li><a href="#">商品J</a></li>
<li><a href="#">商品K</a></li>
<li><a href="#">商品L</a></li>
</ul>
</div>
</div>
</div>
</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">サービス</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">会社概要</a>
</li>
</ul>
</nav>
③ CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
}
.mega-menu-container {
background: #667eea;
padding: 0 20px;
}
.nav-list {
list-style: none;
display: flex;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.nav-link {
display: block;
padding: 20px 15px;
color: white;
text-decoration: none;
font-weight: 500;
transition: background-color 0.3s ease;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
}
.mega-menu {
position: absolute;
top: 64px;
left: 50%;
transform: translateX(-50%) translateY(-10px);
width: 100vw;
background: white;
border-top: 1px solid #e1e5e9;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
z-index: 1000;
}
.nav-item:hover .mega-menu {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(0);
}
.mega-menu-content {
padding: 30px;
max-width: 1200px;
margin: 0 auto;
}
.grid-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 30px;
}
.grid-item {
opacity: 0;
transform: scale(0.8);
transition: all 0.3s ease;
}
.nav-item:hover .grid-item:nth-child(1) {
opacity: 1;
transform: scale(1);
transition-delay: 0.1s;
}
.nav-item:hover .grid-item:nth-child(2) {
opacity: 1;
transform: scale(1);
transition-delay: 0.2s;
}
.nav-item:hover .grid-item:nth-child(3) {
opacity: 1;
transform: scale(1);
transition-delay: 0.3s;
}
.nav-item:hover .grid-item:nth-child(4) {
opacity: 1;
transform: scale(1);
transition-delay: 0.4s;
}
.grid-item h3 {
color: #333;
font-size: 18px;
margin-bottom: 15px;
font-weight: 600;
}
.grid-item ul {
list-style: none;
}
.grid-item li {
margin: 8px 0;
}
.grid-item a {
color: #666;
text-decoration: none;
font-size: 14px;
transition: color 0.2s ease;
}
.grid-item a:hover {
color: #667eea;
}
④ カスタマイズ例
/* グリッド列数の変更 */
.grid-container {
grid-template-columns: repeat(3, 1fr);
}
/* グリッド速度の変更 */
.grid-item {
transition: all 0.5s ease;
}
/* グリッド効果の変更 */
.grid-item {
transform: translateY(-20px);
}
.nav-item:hover .grid-item {
transform: translateY(0);
}
カラム
① デモ
See the Pen メガメニューカラム by ケケンタ (@lgshifbg-the-looper) on CodePen.
- カラム形式の表示
- 整然とした効果
- 視覚的インパクト中
- 整理された印象
② HTML
<nav class="mega-menu-container">
<ul class="nav-list">
<li class="nav-item">
<a href="#" class="nav-link">商品カテゴリ</a>
<div class="mega-menu column">
<div class="mega-menu-content">
<div class="column-container">
<div class="column-item">
<h3>カテゴリ1</h3>
<ul>
<li><a href="#">商品A</a></li>
<li><a href="#">商品B</a></li>
<li><a href="#">商品C</a></li>
</ul>
</div>
<div class="column-item">
<h3>カテゴリ2</h3>
<ul>
<li><a href="#">商品D</a></li>
<li><a href="#">商品E</a></li>
<li><a href="#">商品F</a></li>
</ul>
</div>
<div class="column-item">
<h3>カテゴリ3</h3>
<ul>
<li><a href="#">商品G</a></li>
<li><a href="#">商品H</a></li>
<li><a href="#">商品I</a></li>
</ul>
</div>
<div class="column-item">
<h3>カテゴリ4</h3>
<ul>
<li><a href="#">商品G</a></li>
<li><a href="#">商品H</a></li>
<li><a href="#">商品I</a></li>
</ul>
</div>
</div>
</div>
</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">サービス</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">会社概要</a>
</li>
</ul>
</nav>
③ CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
}
.mega-menu-container {
background: #667eea;
padding: 0 20px;
}
.nav-list {
list-style: none;
display: flex;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.nav-link {
display: block;
padding: 20px 15px;
color: white;
text-decoration: none;
font-weight: 500;
transition: background-color 0.3s ease;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
}
.mega-menu {
position: absolute;
top: 64px;
left: 50%;
transform: translateX(-50%) translateY(-10px);
width: 100vw;
background: white;
border-top: 1px solid #e1e5e9;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
z-index: 1000;
}
.nav-item:hover .mega-menu {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(0);
}
.mega-menu-content {
padding: 30px;
max-width: 1200px;
margin: 0 auto;
}
.column-container {
display: flex;
gap: 40px;
}
.column-item {
flex: 1;
opacity: 0;
transform: translateY(-10px);
transition: all 0.3s ease;
}
.nav-item:hover .column-item:nth-child(1) {
opacity: 1;
transform: translateY(0);
transition-delay: 0.1s;
}
.nav-item:hover .column-item:nth-child(2) {
opacity: 1;
transform: translateY(0);
transition-delay: 0.2s;
}
.nav-item:hover .column-item:nth-child(3) {
opacity: 1;
transform: translateY(0);
transition-delay: 0.3s;
}
.nav-item:hover .column-item:nth-child(4) {
opacity: 1;
transform: translateY(0);
transition-delay: 0.4s;
}
.column-item h3 {
color: #333;
font-size: 18px;
margin-bottom: 15px;
font-weight: 600;
}
.column-item ul {
list-style: none;
}
.column-item li {
margin: 8px 0;
}
.column-item a {
color: #666;
text-decoration: none;
font-size: 14px;
transition: color 0.2s ease;
}
.column-item a:hover {
color: #667eea;
}
④ カスタマイズ例
/* カラム速度の変更 */
.column-item {
transition: all 0.5s ease;
}
/* カラム方向の変更 */
.column-item {
transform: translateX(-10px);
}
.nav-item:hover .column-item {
transform: translateX(0);
}
/* カラム幅の変更 */
.column-item {
flex: 0 0 200px;
}
カード
① デモ
See the Pen メガメニューカード by ケケンタ (@lgshifbg-the-looper) on CodePen.
- カード形式の表示
- 立体的な効果
- 視覚的インパクト大
- モダンな印象
② HTML
<nav class="mega-menu-container">
<ul class="nav-list">
<li class="nav-item">
<a href="#" class="nav-link">商品カテゴリ</a>
<div class="mega-menu card">
<div class="mega-menu-content">
<div class="card-container">
<div class="card-item">
<div class="card-header">
<h3>カテゴリ1</h3>
</div>
<div class="card-body">
<ul>
<li><a href="#">商品A</a></li>
<li><a href="#">商品B</a></li>
<li><a href="#">商品C</a></li>
</ul>
</div>
</div>
<div class="card-item">
<div class="card-header">
<h3>カテゴリ2</h3>
</div>
<div class="card-body">
<ul>
<li><a href="#">商品D</a></li>
<li><a href="#">商品E</a></li>
<li><a href="#">商品F</a></li>
</ul>
</div>
</div>
<div class="card-item">
<div class="card-header">
<h3>カテゴリ3</h3>
</div>
<div class="card-body">
<ul>
<li><a href="#">商品G</a></li>
<li><a href="#">商品H</a></li>
<li><a href="#">商品I</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">サービス</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">会社概要</a>
</li>
</ul>
</nav>
③ CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
}
.mega-menu-container {
background: #667eea;
padding: 0 20px;
}
.nav-list {
list-style: none;
display: flex;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.nav-link {
display: block;
padding: 20px 15px;
color: white;
text-decoration: none;
font-weight: 500;
transition: background-color 0.3s ease;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
}
.mega-menu {
position: absolute;
top: 64px;
left: 50%;
transform: translateX(-50%) translateY(-10px);
width: 100vw;
background: white;
border-top: 1px solid #e1e5e9;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
z-index: 1000;
}
.nav-item:hover .mega-menu {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(0);
}
.mega-menu-content {
padding: 30px;
max-width: 1200px;
margin: 0 auto;
}
.card-container {
display: flex;
gap: 20px;
}
.card-item {
flex: 1;
background: #f8f9fa;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
overflow: hidden;
opacity: 0;
transform: translateY(-20px) scale(0.9);
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item:hover .card-item:nth-child(1) {
opacity: 1;
transform: translateY(0) scale(1);
transition-delay: 0.1s;
}
.nav-item:hover .card-item:nth-child(2) {
opacity: 1;
transform: translateY(0) scale(1);
transition-delay: 0.2s;
}
.nav-item:hover .card-item:nth-child(3) {
opacity: 1;
transform: translateY(0) scale(1);
transition-delay: 0.3s;
}
.card-header {
background: #667eea;
color: white;
padding: 15px 20px;
}
.card-header h3 {
font-size: 16px;
font-weight: 600;
}
.card-body {
padding: 20px;
}
.card-body ul {
list-style: none;
}
.card-body li {
margin: 8px 0;
}
.card-body a {
color: #666;
text-decoration: none;
font-size: 14px;
transition: color 0.2s ease;
}
.card-body a:hover {
color: #667eea;
}
④ カスタマイズ例
/* カード速度の変更 */
.card-item {
transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
/* カード効果の変更 */
.card-item {
transform: translateY(-20px) rotateX(10deg);
}
.nav-item:hover .card-item {
transform: translateY(0) rotateX(0);
}
/* カード色の変更 */
.card-item {
background: #e3f2fd;
}
.card-header {
background: #2196f3;
}
まとめ
今回ご紹介したメガメニュー表示アニメーションは、Webサイトのユーザーエクスペリエンスを向上させる重要な要素です。
実装のコツ
- 適切なアニメーション時間(300ms〜500ms)
- スムーズなイージング関数の使用
- デスクトップデバイスでの動作確認
- アクセシビリティの配慮
- パフォーマンスの最適化
避けるべきポイント
- 過度に複雑なアニメーション
- 長すぎるアニメーション時間
- 読みにくい色の組み合わせ
- パフォーマンスを考慮しない実装
- 過度な使用
おすすめの組み合わせ
- 大型サイト: フェード、スライド
- ECサイト: カスケード、グリッド
- 企業サイト: カラム、カード



特に大型サイトやECサイトでは、メガメニュー表示アニメーションがユーザーエクスペリエンスを大きく左右します。この記事のコードをご活用いただき、より魅力的なWebサイトの制作に繋がれば何よりです。
あわせて読みたい
もっと効率的にWeb制作を学びたい方へ
Web制作の学習は楽しいものですが、一人で進めていると「これで合っているのかな?」と不安になることもありますよね。
僕も独学でWeb制作を学んできましたが、今思うと「もっと早く知りたかった」と思うことがたくさんあります。
特に以下のような方は、一度プログラミングスクールの利用を検討してみることをおすすめします。
- 学習の方向性に迷いがある方
- 効率的にスキルを身につけたい方
- 転職や副業でWeb制作を活用したい方
- 挫折経験がある方
忍者CODEなら、業界最安値で24時間サポート付きの学習環境が整っています。


コメント