cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0">
<ul>
  <li><figure class="fastenwindow" data-image="http://placehold.it/640x480"><img src="http://placehold.it/640x480" width="160" height="120"></figure></li>
  <li><figure class="fastenwindow" data-image="http://placehold.it/640x480"><img src="http://placehold.it/640x480" width="160" height="120"></figure></li>
  <li><figure class="fastenwindow" data-image="http://placehold.it/640x480"><img src="http://placehold.it/640x480" width="160" height="120"></figure></li>
</ul>
            
          
!
            
              ul {
  margin: 34px auto;
  padding: 0;
  list-style: none inside;
}
ul li {
  margin: 0;
  padding: 0;
}
ul li figure {
  margin: 0;
  padding: 0;
  text-align: center;
}
ul li img {
  height: auto;
}
.fastenwindow img {
  cursor: pointer;
}
#whiteout {
  position: fixed;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, .5);
}
#fasten-content {
  position: fixed;
  top: 30px;
  left: 50%;
  margin: 0;
  padding: 0;
  background: #FFFFFF;
  box-shadow: 0 0 .5em rgba(0, 0, 0, .3);
}
#fasten-content figure {
  margin: 0;
  padding: 1em;
  max-width: 100%;
}
#fasten-content img {
  margin: 0;
  padding: 0;
  width: 100%;
}
#fasten-musubu {
  position: fixed;
  top: 0;
  left: 50%;
  margin: 20px 0 0 -17px;
  cursor: pointer;
  width: 34px;
  height: 34px;
}
#fasten-musubu:after,
#fasten-musubu:before {
  content: '';
  width: 1px;
  height: 34px;
  background: #DE0000;
  position: absolute;
  top: 0%;
  left: 50%;
}
#fasten-musubu:before {
  transform: rotate(45deg);
  animation-name: thread1;
  animation-duration: 480ms;
  animation-timing-function: ease;
}
#fasten-musubu:after {
  transform: rotate(-45deg);
  animation-name: thread2;
  animation-duration: 640ms;
  animation-timing-function: ease;
}
@keyframes thread1 {
  0% {
    height: 0;
    transform: rotate(0) rotateX(90deg);
  }
  80% {
    height: 34px;
    transform: rotate(45deg) rotateX(0deg);
  }
}
@keyframes thread2 {
  0% {
    height: 0;
    transform: rotate(0) rotateX(90deg);
  }
  10% {
    height: 0;
    transform: rotate(0) rotateX(90deg);
  }
  100% {
    height: 34px;
    transform: rotate(-45deg) rotateX(0deg);
  }
}

#fasten-musubu.hodoku:before {
  height: 0;
  transform: rotate(0) rotateX(90deg);
  animation-name: hodoku1;
  animation-duration: 640ms;
  animation-timing-function: ease;
}
#fasten-musubu.hodoku:after {
  height: 0;
  transform: rotate(0) rotateX(90deg);
  animation-name: hodoku2;
  animation-duration: 480ms;
  animation-timing-function: ease;
}
@keyframes hodoku1 {
  0% {
    height: 34px;
    transform: rotate(45deg) rotateX(0deg);
  }
  10% {
    height: 34px;
    transform: rotate(45deg) rotateX(0deg);
  }
  100% {
    height: 0;
    transform: rotate(45deg) rotateX(-90deg);
  }
}
@keyframes hodoku2 {
  0% {
    height: 34px;
    transform: rotate(-45deg) rotateX(0deg);
  }
  100% {
    height: 0;
    transform: rotate(-45deg) rotateX(90deg);
  }
}

@media screen and (min-width: 530px) {
  ul li {
    float: left;
    margin: 0;
    padding: 0;
    width: 33%;
    display: inline-block;
  }
}
            
          
!
            
              $('.fastenwindow img').on('click', function(){
  var image = $(this).parent().attr('data-image');
  $('#paste').off().remove();
  $('body').append('<div id="fasten"><div id="whiteout"></div><div id="fasten-content"><figure><img src="' + image + '"></figure></div><div id="fasten-musubu"></div></div>');
  
  $('#fasten-musubu').on('click', function(){
    $(this).addClass('hodoku');
  	$('#fasten').delay(100).animate(
      {opacity: 0},
      640,
      function(){
        $(this).remove();
      }
    );
  });
  fitContent();
});
function fitContent(){
  var cnt = $('#fasten-content'),
      w = $(window),
      ww = w.width(),
      wh = w.height(),
      cntWidth = cnt.width(),
      cntHeight = cnt.height(),
      rev = 30;
  if(wh < cntHeight) {
    cntWidth = (wh - rev * 2) * (cntWidth / cntHeight);
    cntHeight = wh - rev * 2;
  } else if(ww < cntWidth) {
    cntHeight = (ww - rev * 2) * (cntHeight / cntWidth);
    cntWidth = ww - rev * 2;
  }
  cntWidth = Math.round(cntWidth);
  cntHeight = Math.round(cntHeight);
  cnt.css({
    width: cntWidth,
    height: cntHeight,
    left: '50%',
    marginLeft: cntWidth / 2 * -1
  });
}
            
          
!
999px
Loading ..................

Console