modal window with only CSS3 or javascript モーダル画面を作る

css のみ

https://digipress.digi-state.com/tech/simple-modal-window/ おすすめ(履歴残る)

http://on-ze.com/archives/4368 おすすめ(履歴残らない)

https://gingdesign.com/css/css_modal_window.php

http://ithat.me/2015/07/20/css-modal-window  おすすめ(履歴残らない)

http://www.webdesignerdepot.com/2012/10/creating-a-modal-window-with-html5-and-css3

http://coliss.com/articles/build-websites/operation/css/css-useful-tutorials-used-target-pseudo.html

javascript使ってる

http://www.w3schools.com/howto/howto_css_modals.asp  おすすめ

http://www.cssscript.com/minimal-css3-animated-modal-window/

http://tympanus.net/codrops/2013/06/25/nifty-modal-window-effects/

 

 

サンプル) http://ithat.me/2015/07/20/css-modal-window

html—-

<label class="button" for="modal">Open Modal</label>

<div class="modal-box">
  <input type="checkbox" class="toggle-on" id="modal"> <!-- modal 切り替え用 -->
  <label class="toggle-off" for="modal"></label> <!-- modal時、backgroundのアクション -->
  <div class="content ani-rotate">
    <span>
    <p>This is awesome modal window!</p>
    <label class="toggle-button" for="modal">Close</label> <!-- modal時、modal window のアクション -->
    </span>
  </div>
</div>

----

css--

 

html, body {
  position: relative;
  margin: 0;
  padding: 0;
  height: 100%;
  text-align: center;
  background: #f5f5f5;
}
.button {
  display: inline-block;
  margin: 100px 0;
  padding: 12px 34px;
  color: #fff;
  border-radius: 60px;
  font-weight: 500;
  background: #1ecd97;
  -webkit-transition: .24s ease;
  -moz-transition: .24s ease;
  -o-transition: .24s ease;
  transition: .24s ease;
}
.button:hover {
  cursor: pointer;
  background: #1bb787;
}
.modal-box {
  height: 0;
}
.content {
  display: table;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 500px;
  margin: auto;
  padding: 30px 20px;
  vertical-align: middle;
  z-index: -1;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  box-shadow: 0 0 20px rgba(0, 0, 0, .1), 0 5px 10px rgba(0, 0, 0, .15);
  background: #fff;
}
.content > span {
  display: table-cell;
  text-align: center;
  font-size: 28px;
  font-weight: 100;
}
.toggle-on {
  display: none;
}
.toggle-on:checked + .toggle-off + .content {
  z-index: 1;
}
.toggle-off {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  background: rgba(0, 0, 0, .15);
  z-index: -1;
  -webkit-transition: .6s ease-out, 1s z-index ease-out;
  -moz-transition: .6s ease-out, 1s z-index ease-out;
  -o-transition: .6s ease-out, 1s z-index ease-out;
  transition: .6s ease-out, 1s z-index ease-out;
}
.toggle-on:checked + .toggle-off {
  opacity: 1;
  -webkit-transition: .4s ease-in, .3s z-index ease-in;
  -moz-transition: .4s ease-in, .3s z-index ease-in;
  -o-transition: .4s ease-in, .3s z-index ease-in;
  transition: .4s ease-in, .3s z-index ease-in;
  z-index: 1;
}
.toggle-button {
  display: inline-block;
  margin: .8em 0 0;
  padding: .5em 1.2em;
  color: #fff;
  font-size: 20px;
  font-weight: 300;
  border-radius: 4px;
  background: #1ecd97;
  -webkit-transition: .24s ease;
  -moz-transition: .24s ease;
  -o-transition: .24s ease;
  transition: .24s ease;
}
.toggle-button:hover {
  cursor: pointer;
  background: #1bb787;
}

/* rotate */
.ani-rotate {
  opacity: 0;
  -webkit-transition: .4s ease, 1s z-index ease;
  -moz-transition: .4s ease, 1s z-index ease;
  -o-transition: .4s ease, 1s z-index ease;
  transition: .4s ease, 1s z-index ease;
  -webkit-transform: rotate(450deg);
  -moz-transform: rotate(450deg);
  -ms-transform: rotate(450deg);
  transform: rotate(450deg);
}
.toggle-on:checked + .toggle-off + .ani-rotate {
  opacity: 1;
  -webkit-transition: .4s ease;
  -moz-transition: .4s ease;
  -o-transition: .4s ease;
  transition: .4s ease;
  -webkit-transform: rotate(0);
  -moz-transform: rotate(0);
  -ms-transform: rotate(0);
  transform: rotate(0);

----

Leave a Reply

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です