<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
</script>
<style>@charset "utf-8";

/*========= 検索窓を開くためのボタン設定 ===========*/

.open-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: url("/wp-content/uploads/demos/_assets/icon_search.svg") no-repeat
    15px center; /*虫眼鏡アイコンを背景に表示*/
  background-size: 20px 20px;
  width: 50px;
  height: 50px;
  cursor: pointer; /*カーソルを指マークに*/
}

/*クリック後、JSでボタンに btnactive クラスが付与された後の見た目*/
.open-btn.btnactive {
  background: url("/wp-content/uploads/demos/_assets/icon_close.svg") no-repeat
    15px center; /*閉じるアイコンを背景に表示*/
  background-size: 18px 18px;
}

/*========= 検索窓の設定 ===============*/

/*==検索窓背景のエリア*/

#search-wrap {
  position: absolute; /*絶対配置にして*/
  top: 150px;
  right: 20px;
  z-index: -1; /*最背面に設定*/
  opacity: 0; /*透過を0に*/
  width: 0; /*横幅は0に*/
  transition: all 0.4s; /*transitionを使ってスムースに現れる*/
  border-radius: 5px;
}

/*ボタンクリック後、JSで#search-wrapに panelactive クラスが付与された後の見た目*/
#search-wrap.panelactive {
  opacity: 1; /*不透明に変更*/
  z-index: 3; /*全面に出現*/
  width: 280px;
  padding: 20px;
  top: 60px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
}

/*==検索窓*/
#search-wrap #searchform {
  display: none; /*検索窓は、はじめ非表示*/
}

/*ボタンクリック後、JSで#search-wrapに panelactive クラスが付与された後*/
#search-wrap.panelactive #searchform {
  display: block; /*検索窓を表示*/
}

/*==検索フォームの設定*/

/*==テキスト入力とボタンinput共通設定*/
#search-wrap input {
  -webkit-appearance: none; /*SafariやChromeのデフォルトの設定を無効*/
  outline: none;
  cursor: pointer; /*カーソルを指マークに*/
  color: #666;
}

/*テキスト入力input設定*/
#search-wrap input[type="text"] {
  width: 100%;
  border: none;
  border-bottom: 2px solid #ccc;
  transition: all 0.5s;
  letter-spacing: 0.05em;
  height: 46px;
  padding: 10px;
}

/*テキスト入力inputにフォーカスされたら*/
#search-wrap input[type="text"]:focus {
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5); /*背景色を付ける*/
}

/*ボタンinput設定*/
#search-wrap input[type="submit"] {
  position: absolute;
  top: 10px;
  right: 30px;
  background: url("/wp-content/uploads/demos/_assets/icon_search.svg") no-repeat
    right; /*虫眼鏡アイコンを背景に表示*/
  background-size: 20px 20px;
  width: 30px;
  height: 60px;
}

/*========= レイアウトのためのCSS ===============*/
img {
  width: 100%;
  height: 100vh;
  vertical-align: middle;
  filter: brightness(95%) blur(1px);
  object-fit: cover;
}

.text {
  margin: 0 0 10px 0;
  position: absolute;
  mix-blend-mode: overlay;
  color: white;
  font-size: clamp(12px, 3vw, 2rem);
  font-weight: bold;
  text-align: left;
  top: 20px;
  left: 20px;
}</style>
</head>
<body>
<body>
<img src="http://localhost:10072/wp-content/uploads/demos/_assets/wave.jpeg" />
<div class="open-btn">
</div>
<p class="text">虫眼鏡マークをクリックすると<br>下からふわっと検索窓が出現</p>
<div id="search-wrap">
<form role="search" method="get" id="searchform" action="">
<input type="text" value="" name="" id="search-text" placeholder="search">
<input type="submit" id="searchsubmit" value="">
</form>
</div>
<!--/search-wrap-->
<script>//開閉ボタンを押した時には
$(".open-btn").click(function () {
  $(this).toggleClass("btnactive"); //.open-btnは、クリックごとにbtnactiveクラスを付与&除去。1回目のクリック時は付与
  $("#search-wrap").toggleClass("panelactive"); //#search-wrapへpanelactiveクラスを付与
  $("#search-text").focus(); //テキスト入力のinputにフォーカス
});
//# sourceURL=pen.js</script>
</body>
</html>
/* 
   外部依存 CSS:
     - https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css
   外部依存 JS (このデモは下記の JS にも依存します):
     - https://code.jquery.com/jquery-3.4.1.min.js
 */

@charset "utf-8";

/*========= 検索窓を開くためのボタン設定 ===========*/

.open-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: url("/wp-content/uploads/demos/_assets/icon_search.svg") no-repeat
    15px center; /*虫眼鏡アイコンを背景に表示*/
  background-size: 20px 20px;
  width: 50px;
  height: 50px;
  cursor: pointer; /*カーソルを指マークに*/
}

/*クリック後、JSでボタンに btnactive クラスが付与された後の見た目*/
.open-btn.btnactive {
  background: url("/wp-content/uploads/demos/_assets/icon_close.svg") no-repeat
    15px center; /*閉じるアイコンを背景に表示*/
  background-size: 18px 18px;
}

/*========= 検索窓の設定 ===============*/

/*==検索窓背景のエリア*/

#search-wrap {
  position: absolute; /*絶対配置にして*/
  top: 150px;
  right: 20px;
  z-index: -1; /*最背面に設定*/
  opacity: 0; /*透過を0に*/
  width: 0; /*横幅は0に*/
  transition: all 0.4s; /*transitionを使ってスムースに現れる*/
  border-radius: 5px;
}

/*ボタンクリック後、JSで#search-wrapに panelactive クラスが付与された後の見た目*/
#search-wrap.panelactive {
  opacity: 1; /*不透明に変更*/
  z-index: 3; /*全面に出現*/
  width: 280px;
  padding: 20px;
  top: 60px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
}

/*==検索窓*/
#search-wrap #searchform {
  display: none; /*検索窓は、はじめ非表示*/
}

/*ボタンクリック後、JSで#search-wrapに panelactive クラスが付与された後*/
#search-wrap.panelactive #searchform {
  display: block; /*検索窓を表示*/
}

/*==検索フォームの設定*/

/*==テキスト入力とボタンinput共通設定*/
#search-wrap input {
  -webkit-appearance: none; /*SafariやChromeのデフォルトの設定を無効*/
  outline: none;
  cursor: pointer; /*カーソルを指マークに*/
  color: #666;
}

/*テキスト入力input設定*/
#search-wrap input[type="text"] {
  width: 100%;
  border: none;
  border-bottom: 2px solid #ccc;
  transition: all 0.5s;
  letter-spacing: 0.05em;
  height: 46px;
  padding: 10px;
}

/*テキスト入力inputにフォーカスされたら*/
#search-wrap input[type="text"]:focus {
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5); /*背景色を付ける*/
}

/*ボタンinput設定*/
#search-wrap input[type="submit"] {
  position: absolute;
  top: 10px;
  right: 30px;
  background: url("/wp-content/uploads/demos/_assets/icon_search.svg") no-repeat
    right; /*虫眼鏡アイコンを背景に表示*/
  background-size: 20px 20px;
  width: 30px;
  height: 60px;
}

/*========= レイアウトのためのCSS ===============*/
img {
  width: 100%;
  height: 100vh;
  vertical-align: middle;
  filter: brightness(95%) blur(1px);
  object-fit: cover;
}

.text {
  margin: 0 0 10px 0;
  position: absolute;
  mix-blend-mode: overlay;
  color: white;
  font-size: clamp(12px, 3vw, 2rem);
  font-weight: bold;
  text-align: left;
  top: 20px;
  left: 20px;
}
/* 
   外部依存 JS:
     - https://code.jquery.com/jquery-3.4.1.min.js
   外部依存 CSS (このデモは下記の CSS にも依存します):
     - https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css
 */

//開閉ボタンを押した時には
$(".open-btn").click(function () {
  $(this).toggleClass("btnactive"); //.open-btnは、クリックごとにbtnactiveクラスを付与&除去。1回目のクリック時は付与
  $("#search-wrap").toggleClass("panelactive"); //#search-wrapへpanelactiveクラスを付与
  $("#search-text").focus(); //テキスト入力のinputにフォーカス
});
//# sourceURL=pen.js