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.

            
              <h2>fancyBox v3.2 - Inline content</h2>

<div class="grid">
  
  <p>
    #1 - Default example
  </p>
  <p>
    <a data-fancybox data-src="#modal" href="javascript:;" class="btn">Open demo</a>
  </p>

  <div style="display: none;" id="modal">
    <h2>Hello!</h2>
    <p>You are awesome!</p>
  </div>
  
</div>
<div class="grid">

  <p>
    #2 - Custom open/close animation
  </p>
  <p>
    <a data-fancybox data-animation-duration="700" data-src="#animatedModal" href="javascript:;" class="btn">Open demo</a>
  </p>

  <div style="display: none;" id="animatedModal" class="animated-modal">
    <h2>Hello!</h2>
    <p>This is animated content! Cool, right?</p>
  </div>

</div>

<div class="grid">

  <p>
    #3 - Modal window
  </p>

  <p>
    <a data-fancybox data-src="#trueModal" data-modal="true" href="javascript:;" class="btn">Open demo</a>
  </p>

  <div style="display: none;max-width:600px;" id="trueModal">
    <h2>I'm a modal!</h2>
    <p>You can close me only by pressing custom button below.</p>
    <p>It would also be possible to prevent closing using `beforeClose` callback.</p>
    <p><button data-fancybox-close class="btn">Close me</button></p>
  </div>
  
</div>

<div class="grid">

  <p>
    #4 - Custom options
  </p>

  <p>
    <a data-fancybox data-options='{"src": "#exampleModal", "touch": false, "smallBtn" : false}' href="javascript:;" class="btn">Open demo</a>
  </p>

  <div style="display: none;max-width:500px;" id="exampleModal">
    <h2>¡Hola!</h2>
    <p>You can chose to display small close button (customizable using `btnTpl.smallBtn` option; you can put any html here) or display the toolbar instead.</p>
  </div>
  
</div>

<div class="grid">

  <p>
    #5 - Make element selectable/clickable
  </p>

  <p>
    <a data-fancybox data-src="#selectableModal" href="javascript:;" class="btn">Open demo</a>
  </p>

  <div style="display: none;max-width:500px;" id="selectableModal">
    <h2 data-selectable="true">Ciao!</h2>
    <p data-selectable="true">Sometimes you would want to disable "touch" feature. <br />For example, when you want to make your content selectable.</p>
  </div>
  
</div>
            
          
!
            
              /*

   Styles for animated modal
   =========================

*/

/* Start state */
.animated-modal {
  max-width: 550px;
  border-radius: 4px;
  overflow: hidden;
  
  transform: translateY(-50px);
  transition: all .7s;
}

.animated-modal h2,
.animated-modal p {
  transform: translateY(-50px);
  opacity: 0;
  
  transition-property: transform, opacity;
  transition-duration: .4s;
}

/* Final state */
.fancybox-slide--current .animated-modal,
.fancybox-slide--current .animated-modal h2,
.fancybox-slide--current .animated-modal p {
  transform: translateY(0);
  opacity: 1;
}

/* Reveal content with different delays */
.fancybox-slide--current .animated-modal h2 {
  transition-delay: .1s;
}

.fancybox-slide--current .animated-modal p {
  transition-delay: .3s;
}

            
          
!
999px
Loading ..................

Console