イセンチュートリアルサイト
  • CSS
    • スクロールダウン
    • テキストナビゲーション
    • ボタン
    • メニュー
    • 動画
    • 検索
    • 画像リンクの動き
    • 背景の動き
  • Illustrator
  • JS
    • アコーディオンパネル
    • アニメーション
    • エリアの動き
    • ギャラリー
    • グラフ
    • スライド
    • テキストの動き
    • ニュースティッカー
    • ページトップリンク
    • ページ内リンク
    • メニュー
    • モーダルウィンドウ
    • ローディング
  • Photoshop
  • PHP
  • WordPress
    • プラグイン
    • リンク
  • お客様観覧用
    • WEB制作プラン
    • アニメーション
    • グローバルナビゲーション
    • スライド
  • サーバー
    • CPI
  • 未分類
  • 法律
    • 医療法
    • 柔道整復師法
TOP CSS メニュー ハンバーガーメニュー(3本線が×に)

CSS

ハンバーガーメニュー(3本線が×に)

  • カテゴリー:メニュー

    html

    <div class="openbtn1"><span></span><span></span><span></span></div>

     

    CSS

    /*==================================================
    5-2-1 3本線が×に
    ===================================*/
    /*ボタン外側※レイアウトによってpositionや形状は適宜変更してください*/
    	.openbtn1 {
    	position: relative;/*ボタン内側の基点となるためrelativeを指定*/
    	background:#57a2c7;
    	cursor: pointer;
    	width: 50px;
    	height:50px;
    	border-radius: 5px;
    }
    
    /*ボタン内側*/
    .openbtn1 span {
    	display: inline-block;
    	transition: all .4s;/*アニメーションの設定*/
    	position: absolute;
    	left: 14px;
    	height: 3px;
    	border-radius: 2px;
    	background: #fff;
    	width: 45%;
    }
    .openbtn1 span:nth-of-type(1) {
    	top:15px;
    }
    .openbtn1 span:nth-of-type(2) {
    	top:23px;
    }
    .openbtn1 span:nth-of-type(3) {
    	top:31px;
    }
    
    /*activeクラスが付与されると線が回転して×に*/
    .openbtn1.active span:nth-of-type(1) {
    	top: 18px;
    	left: 18px;
    	transform: translateY(6px) rotate(-45deg);
    	width: 30%;
    }
    
    /*真ん中の線は透過*/
    .openbtn1.active span:nth-of-type(2) {
    	opacity: 0;
    }
    .openbtn1.active span:nth-of-type(3) {
    	top: 30px;
    	left: 18px;
    	transform: translateY(-6px) rotate(45deg);
    	width: 30%;
    }
    
    /*========= レイアウトのためのCSS ===============*/
    body {
    	background:#f3f3f3;
    	padding:20px;
    }
    
    a {
    	color: #333;
    	text-decoration: none;
    }
    
    .lead {
    	margin:20px 0 0 0;
    }
    
    .btn-block {
    	width:200px;
    	padding: 30px;
    }

     

    JS

    $(".openbtn1").click(function () {
    	$(this).toggleClass('active');
    });

     

    引用元:https://coco-factory.jp/ugokuweb/move01/5-2-1/

    投稿日:2022年04月05日

アーカイブ

  • CSS (117)
    • スクロールダウン (8)
    • テキストナビゲーション (11)
    • ボタン (52)
    • メニュー (1)
    • 動画 (2)
    • 検索 (3)
    • 画像リンクの動き (23)
    • 背景の動き (17)
  • Illustrator (8)
  • JS (93)
    • アコーディオンパネル (2)
    • アニメーション (1)
    • エリアの動き (7)
    • ギャラリー (6)
    • グラフ (7)
    • スライド (9)
    • テキストの動き (17)
    • ニュースティッカー (1)
    • ページトップリンク (9)
    • ページ内リンク (2)
    • メニュー (28)
    • モーダルウィンドウ (1)
    • ローディング (3)
  • Photoshop (1)
  • PHP (20)
  • WordPress (4)
    • プラグイン (2)
    • リンク (1)
  • お客様観覧用 (11)
    • WEB制作プラン (1)
    • アニメーション (8)
    • グローバルナビゲーション (1)
    • スライド (1)
  • サーバー (6)
    • CPI (1)
  • 未分類 (6)
  • 法律 (2)
    • 医療法 (1)
    • 柔道整復師法 (1)
TOP
  • CSS
    • スクロールダウン
    • テキストナビゲーション
    • ボタン
    • メニュー
    • 動画
    • 検索
    • 画像リンクの動き
    • 背景の動き
  • Illustrator
  • JS
    • アコーディオンパネル
    • アニメーション
    • エリアの動き
    • ギャラリー
    • グラフ
    • スライド
    • テキストの動き
    • ニュースティッカー
    • ページトップリンク
    • ページ内リンク
    • メニュー
    • モーダルウィンドウ
    • ローディング
  • Photoshop
  • PHP
  • WordPress
    • プラグイン
    • リンク
  • お客様観覧用
    • WEB制作プラン
    • アニメーション
    • グローバルナビゲーション
    • スライド
  • サーバー
    • CPI
  • 未分類
  • 法律
    • 医療法
    • 柔道整復師法
© 2022 isen-print.