A Pen by suzuki

Thumbnail
This awesome code was written by JunkiSuzuki, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright JunkiSuzuki ©
  • HTML
  • CSS
  • JavaScript
    <section class="page_contents">
  <!-- sp表示用ここから -->
  <input type="checkbox" id="switch_menu"/>
  <label for="switch_menu" class="switch_search">並び替える/絞り込み</label>
  <div class="search_menu_header">並び替える/絞り込
  </div>
  <label for="switch_menu" class="back_menu"><img src="
https://placehold.jp/25x25.png" alt="back_buttonの画像" width="25" height="25" border="0" /></label>
  <form class="search_menu" action="">
    <fieldset>
      <label for="accordion_sort_menu" class="search_label" id="order-by">並び替え</label>
      <!-- <div class="accordion_sort_menu_button"></div> -->
      <input type="checkbox" id="accordion_sort_menu"/>
      <div class="sort_wrapper">
        <input type="radio" name="sort_order" id="order_arrival" />
        
        <label for="order_arrival" class="search_box order_arrival">新着順</label>
        <input type="radio" name="sort_order" id="order_product_name_asc" />
        <label for="order_product_name_asc" class="search_box order_product_name">商品名昇順</label>
        <input type="radio" name="sort_order" id="order_product_name_desc" />
        <label for="order_product_name_desc" class="search_box order_product_name">商品名降順</label>
        <input type="radio" name="sort_order" id="order_product_no_asc" />
        <label for="order_product_no_asc" class="search_box order_product_no">商品番号大</label>
        <input type="radio" name="sort_order" id="order_product_no_desc" />
        <label for="order_product_no_desc" class="search_box order_product_no">商品番号小</label>
        <input type="radio" name="sort_order" id="order_price_desc" />
        <label for="order_price_desc" class="search_box order_price">価格の安い順</label>
        <input type="radio" name="sort_order" id="order_price_asc" />
        <label for="order_price_asc" class="search_box order_price">価格の高い順</label>
      </div>
      <label for="accordion_narrowing_menu" class="search_label"><span>絞り込み<span>
      </label>
      <input type="checkbox" id="accordion_narrowing_menu"/>
      <!-- <span class="accordion_narrowing_menu_button"></span> -->
      <div class="narrowing_wrapper">
        <input type="radio" name="narrow_menu" id="narrow_menu_none" />
        <label for="narrow_menu_none" class="search_box none">なし</label>
        <input type="radio" name="narrow_menu" id="narrow_menu_stock" />
        <label for="narrow_menu_stock" class="search_box stock">残りわずか</label>
        <input type="radio" name="narrow_menu" id="narrow_menu_special_price" />
        <label for="narrow_menu_special_price" class="search_box special_price">特別価格</label>
        <input type="radio" name="narrow_menu" id="narrow_menu_review" />
        <label for="narrow_menu_review" class="search_box review">レビュー</label>
      </div>
      
      <label for="accordion_price_menu" class="input_area_wrapper_label search_label">価格</label>
      <div class="input_area_wrapper">
        <input type="checkbox" id="accordion_price_menu"/>
        <div class="search_price_wrapper">
          <input type="number" class="input_yen" name="vcPrf" id="vcPrf" maxlength="7" value="">
          <span class="search_price_label">円~</span>
          <input type="number" class="input_yen" name="vcPrt" id="vcPrt" maxlength="7" value="">
          <span class="search_price_label">円</span>
        </div>
      </div>
      <label for="accordion_product_name_menu" class="input_area_wrapper_label search_label">商品名の一部</label>
      <div class="input_area_wrapper">
        <input type="checkbox" id="accordion_product_name_menu"/>
        <div class="search_product_name_wrapper">
          <input type="search" class="input_product" name="vcKey" id="veKey" value=""/>
          <button type="submit" class="search_button" name="action" value="true">検索</button>
        </div>
      </div>
      </div>
    </fieldset>
  </form>
<div class="sp_search_button">
        <button type="submit" class="search_button" name="action" value="true">検索</button>

  <!-- sp表示用ここまで -->
</section>

/*Downloaded from https://www.codeseek.co/JunkiSuzuki/a-pen-by-suzuki-BRproW */
    @charset "utf-8";

/*
html5doctor.com Reset Stylesheet
v1.4
2009-07-27
Author: Richard Clark - http://richclarkdesign.com
*/

html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, dialog, figure, footer, header,
hgroup, menu, nav, section,
time, mark, audio, video {
    margin:0;
    padding:0;
    border:0;
    outline:0;
    font-size:100%;
    vertical-align:baseline;
    background:transparent;
}
body {
    line-height:1;
}

article, aside, dialog, figure, footer, header,
hgroup, nav, section {
    display:block;
}

nav ul {
    list-style:none;
}

blockquote, q {
    quotes:none;
}

blockquote:before, blockquote:after,
q:before, q:after {
    content:'';
    content:none;
}

a {
    margin:0;
    padding:0;
    border:0;
    font-size:100%;
    vertical-align:baseline;
    background:transparent;
}

ins {
    background-color:#ff9;
    color:#000;
    text-decoration:none;
}

mark {
    background-color:#ff9;
    color:#000;
    font-style:italic;
    font-weight:bold;
}

del {
    text-decoration: line-through;
}

abbr[title], dfn[title] {
    border-bottom:1px dotted #000;
    cursor:help;
}

table {
    border-collapse:collapse;
    border-spacing:0;
}

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #cccccc;
    margin: 1em 0;
    padding: 0;
}

input, select {
    vertical-align: middle;
}

input[type="radio"] {
  display: none;
}

input[type="checkbox"] {
  display: none;
}

body {
  -webkit-text-size-adjust: 100%;
}

button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  padding: 0;
  appearance: none;
}

.page_contents {
  width: 1200px;
  max-width: 100%;
  display: block;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  -ms-box-sizing: border-box;
}

/*
search menu
*/
.search_menu {
  width: 76.667%;
  border: 0px solid #DDD;
  margin: 2.417% 0 0 1.667%;
  background: #FFF;
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flex;
  display: flex;  
  transition: transform 0.15s ease-out; 
}

.search_menu input[type="radio"]:checked + label {
  border: 2px solid #ED5D5F;
}

.switch_search {
  display: none;
}

.search_label {
  display: table;
  color: #4A4A4A;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
}
/* クリック前 */
.search_label:after {
   content: '';
    position: absolute;
    /* top: 50%; */
    right: -50px;
    /* left: 20px; */
    display: block;
    width: 21px;
    height: 21px;
    margin-top: -20px;
    background-size: 21px 21px;
  background-image: url('https://c.bookwalker.jp/louis/sp/img/detail/1_icon_close_area.gif')
}
/* クリックした時のイベント(完成品ではない) */
/*.search_label:active:after {
  content: '';
    position: absolute;
    right: -50px;
    display: block;
    width: 21px;
    height: 21px;
    margin-top: -20px;
    background-size: 21px 21px;
  background-image: url('https://c.bookwalker.jp/louis/sp/img/detail/1_icon_close_area.gif')
}*/

.search_box {
  width: 100%;
  height: 32px;
  margin: 0px 0.597% 0px 0px;
  background: #FFF;
  border: 1px solid #DDD;
  border-radius: 3px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  cursor: pointer;
  display: flex;
  color: #4A4A4A;
  -webkit-align-items: center;
  -moz-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  -moz-justify-content: center;
  justify-content: center;
}

.search_box:hover {
  border: 2px solid #ED5D5F;
}

.search_box.order_arrival {
  width: 13.594%;
  min-width: 70px;
}

.search_box.order_product_name {
  width: 16.793%;
  min-width: 105px;
}

.search_box.order_product_no {
  width: 16.793%;
  min-width: 105px;
}

.search_box.order_price {
  width: 16.554%;
  min-width: 120px;
}

.search_box.none {
  width: 6.523%;
}

.search_box.stock {
  width: 11.848%;
  min-width: 105px;
}

.search_box.special_price {
  width: 11.305%;
  min-width: 92px;
}

.search_box.review {
  width: 9.132%;
  min-width: 92px;
}

.sort_wrapper {
  width: 100%;
  margin: 0.87% 0 1.848% 0;
  background: #FFF;
  display: flex;
  flex-wrap: wrap;
  -webkit-align-items: top;
  align-items: top;
  -webkit-justify-content: left;
  justify-content: left;
} 

.narrowing_wrapper {
  width: 100%;
  margin: 0.87% 0 1.848% 0;
  background: #FFF;
  display: -moz-flex;
    display: -o-flex;
    display: -webkit-flex;
    display: -ms-flex;
  display: flex;
  flex-wrap: wrap;
  -webkit-align-items: top;
  align-items: top;
  -webkit-justify-content: left;
  justify-content: left;
}

.input_area_wrapper {
  width: 100%;
  margin: 0.87% 0 1.848% 0;
  background: #FFF;
  display: flex;
  display: -moz-flex;
    display: -o-flex;
    display: -webkit-flex;
    display: -ms-flex;
  -webkit-align-items: top;
  align-items: top;
  -webkit-justify-content: left;
  justify-content: left;
}

.input_area_wrapper_label {
  width: 100%;
  display: box;
  color: #4A4A4A;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  margin: 0px 0px 1.693% 0px;
}

.search_price_wrapper {
  position: relative;
  width: 40%;
  margin: 0;
  background: #FFF;
  height: 100%;
  background: #FFF;
  display: flex;
  display: -moz-flex;
    display: -o-flex;
    display: -webkit-flex;
    display: -ms-flex;
  flex-flow: wrap;
  -webkit-box-orient: vertical;
  -moz-box-orient: vertical;
  -ms-box-orient: vertical;
  box-orient: vertical;
}

.input_yen {
  display: flex;
  border: 1px;
  width: 29.62%;
  height: 36px;
  margin: 0px;
  padding: 0 0 0 5px;
  color:#222;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.7) inset;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: left;
  justify-content: left;
}

.search_price_label {
  display: flex;
  height: 36px;
  margin: 0px 2.175% 0px 2.175%;
  padding: 0px;
  color: #4A4A4A;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  display: flex;
  display: -moz-flex;
    display: -o-flex;
    display: -webkit-flex;
    display: -ms-flex;
  -webkit-align-items: center;
  -moz-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  -moz-justify-content: center;
  justify-content: center;
}

.search_product_name_wrapper {
  width: 55%;
  margin: 0;
  background: #FFF;
  height: 100%;
  background: #FFF;
  display: flex;
  flex-flow: wrap;
  -webkit-box-orient: vertical;
  -moz-box-orient: vertical;
  -ms-box-orient: vertical;
  box-orient: vertical;
}

.input_product {
  width: 40.514%;
  height: 36px;
  border: 1px;
  margin: 0px;
  padding: 0 0 0 5px;
  box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.7) inset;
  color:#222;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: left;
  justify-content: left;
}

.search_button {
  border-radius: 2px;
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  width: 33.597%;
  background: #EB5D5E;
  color: #FFF;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  height: 36px;
  display: flex;
  display: -moz-flex;
    display: -o-flex;
    display: -webkit-flex;
    display: -ms-flex;
  -webkit-align-items: center;
  -moz-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  -moz-justify-content: center;
  justify-content: center;
  padding: 0px;
  margin: 0px 0px 0px 11.883%;
}

.switch_search {
  display: flex;
  width: 76.25%;
  height: 46px;
  margin: 0.376% 11.75% 0 11.75%;
  color: #ED5D5F;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  -webkit-align-items: center;
  -moz-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  -moz-justify-content: center;
  justify-content: center;
  border: 1px solid #ED5D5F;
  border-radius: 3px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  cursor: pointer; 
  transition: transform 0.25s ease-in 0s; 
}

.accordion_menu_wrapper {
    background-color: #ddd; 
    box-sizing: border-box;
    height: 100%;
    padding: 10px 40px; 
    position: fixed;
    right: 100%; 
    top: 0;
    margin:0 auto;
    transition: transform 0.3s linear 0s; 
    width: 100%; 
    z-index: 2;
}

.accordion_menu_wrapper label {
    display: none;
    margin: 0 0 2px 0;
    padding :12px;
    line-height: 1;
    color :#fff;
    background :#007bbb;
}

.accordion_menu_wrapper ul {
    margin: 0;
    padding: 0;
    background :#f4f4f4;
    list-style: none;
}

.accordion_menu_wrapper li {
  max-height: 0;
  overflow-y: hidden;
  -webkit-transition: all 0.5s;
  -moz-transition: all 0.5s;
  -ms-transition: all 0.5s;
  -o-transition: all 0.5s;
  transition: all 0.5s;
}

#accordion_menu01:checked ~ #menu01 li{
  max-height: 46px;
  opacity: 1;
}

.search_menu_header{
  display: flex;
  width: 100vw;
  height: 50px;
  color: #ED5D5F; 
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  -webkit-align-items: center;
  -moz-align-items: center;
  background: #ffbaba;
  align-items: center;
  -webkit-justify-content: center;
  -moz-justify-content: center;
  justify-content: center;
  border: 1px solid #ED5D5F;  
  margin-bottom:10px;
  position: fixed;
  left: -101vw;
  top: 0;
  z-index: 99;
  transition: all 0.15s;
}

.sp_search_button .search_button {
  width: 95vw;
  position: fixed;
  bottom: 5px;
  left: -100vw;
  margin: 0px 0px 0px 2.5vw;
  transition: all 0.2s ;
}

.search_button {
  border-radius: 2px;
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  width: 33.597%;
  background: #EB5D5E;
  color: #FFF;
  font-size: 14pt;
  font-family: "メイリオ", Meiryo, sans-serif;
  height: 36px;
  display: flex;
  display: -moz-flex;
    display: -o-flex;
    display: -webkit-flex;
    display: -ms-flex;
  -webkit-align-items: center;
  -moz-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  -moz-justify-content: center;
  justify-content: center;
  padding: 0px;
  margin: 0px 0px 0px 11.883%;
}

.back_menu {
   display:flex;
   justify-content: center;
   align-items: center;
   cursor: pointer;
   position: fixed;
   left: -5vw;
   top: 20px;
   z-index:101;
   transition: 0.2s all;
 }
/*  debug
/*  320以上  
  
@media screen and (max-width: 320px) {
  .search_menu {
    display: none;
  }
}

/* 321以上 480以下 
@media screen and (min-width: 321px) and (max-width: 480px) {
  .search_menu {
    display: none;
  }
}
/* 481以上 640以下 
@media screen and (min-width: 481px) and (max-width: 640px) {
  .search_menu {
    display: none;
  }
}
debug */

@media screen and (min-width: 300px) and (max-width: 800px) {  
  body {
    overflow-x: hidden;
  }
    
  .sp_search_button {
   width: 100vw;
   height: 60px;
   border-top: solid 1px black;
   background: white;
   z-index: 98;
   position: fixed;
   bottom: 0;
   left: -100vw;
  }
  
  .search_product_name_wrapper .search_button{
    display:none;
  }
  #switch_menu:not(:checked) ~ .search_menu{
    position: relative;
    left: -120%;
  }
  
  .search_label,.input_area_wrapper_label {
    display: block;
    width: 100vw;
    padding: 0px 0px 10px 10px;
    border-bottom: 1px solid #000;
  }
 
  .accordion_sort_menu_button {
    width: 25px;
    height: 25px;
    background: red;
    position: relative;
    top: -7vh;
    left: 90vw;
  }
  
  .accordion_narrowing_menu_button {
    display:flex;
    width:25px;
    height:25px;
    justify-content: center;
    background-image: url("https://placehold.jp/fc0303/ffffff/25x25.jpg");
    position: relative;
    top: -25px;
    left: 89vw;
  }
  
  #switch_menu:checked ~ .switch_search {
    transform: translate(100%);
    z-index: -1;
  }
  
  #switch_menu:checked ~ .search_menu_header {
    transform: translate(101vw);
  }
  
  #switch_menu:checked ~ .back_menu {
    transform: translate(95vw); 
  }
  
  #switch_menu:checked ~ .search_menu {
    display: block;
    position: relative;
    padding-right: 0;
    margin: 0;
    left: -100vw;
    transform: translate(100vw);
    z-index: 1;
    top: 20px;
  }
  
  #switch_menu:checked ~ .sp_search_button .search_button {
    transform: translate(100vw);
    z-index: 99;
  }
  
  #switch_menu:checked ~ .sp_search_button {
    transform: translate(100vw);
    z-index: 99;
  }
  
  .sort_wrapper {
    width:98vw;
    margin-left:2.5vw;
    max-height: 0;
    overflow: hidden;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -ms-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
  }
  
  .narrowing_wrapper{
    max-height: 0;
    overflow: hidden;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -ms-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
  }
  
  .search_price_wrapper{
    margin: 0px;
    max-height: 0;
    overflow: hidden;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -ms-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
  }
  
  .search_product_name_wrapper{
    margin: 0px;
    max-height: 0;
    overflow: hidden;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -ms-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
  }

  #accordion_sort_menu:checked ~ .sort_wrapper,#accordion_narrowing_menu:checked ~ .narrowing_wrapper {
    max-height: 150px;
    opacity: 1;
  }

    #accordion_narrowing_menu:checked ~ .accordion_narrowing_menu_button {
      background-image: url("https://placehold.jp/d1d1d1/ffffff/25x25.jpg");
    }
  
  #accordion_price_menu:checked ~ .search_price_wrapper,  #accordion_product_name_menu:checked ~ .search_product_name_wrapper {
    max-height: 50px;
    opacity: 1;
  }
  
/*   .sp_search_button .search_button {
    bottom: 0;
    z-index: 100;
  } */
}

/*
801以上
*/
@media screen and (min-width: 801px) {
  .switch_search {
    display: none;
  }
  .search_menu_header {
    display: none;
  }
  .sp_search_button {
    display: none;
  }
  
}


/*Downloaded from https://www.codeseek.co/JunkiSuzuki/a-pen-by-suzuki-BRproW */
    

Comments