Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

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

<hr class="my-5" />

<div class="row mb-4">
  <div class="card-deck col-9">

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

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

      </div>
    </div>

    <div class="card">
      <div class="card-body">
        <p>
          #2 - Custom open/close animation
        </p>
        <p class="mb-0">
          <a data-fancybox data-animation-duration="700" data-src="#animatedModal" href="javascript:;" class="btn btn-primary">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>

    <div class="card">
      <div class="card-body">
        <p>
          #3 - Modal window
        </p>

        <p class="mb-0">
          <a data-fancybox data-src="#trueModal" data-modal="true" href="javascript:;" class="btn btn-primary">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>

  </div>
</div>
<div class="row mb-4">
  <div class="card-deck col-9">

    <div class="card">
      <div class="card-body">
        <p>
          #4 - Custom options
        </p>

        <p>
          <a data-fancybox data-options='{"src": "#exampleModal", "touch": false, "smallBtn" : false}' href="javascript:;" class="btn btn-primary">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>


    <div class="card">
      <div class="card-body">
        <p>
          #5 - Make element selectable/clickable
        </p>

        <p>
          <a data-fancybox data-src="#selectableModal" href="javascript:;" class="btn btn-primary">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>
    </div>

  </div>
</div>

              
            
!

CSS

              
                /*

   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;
}





              
            
!

JS

              
                
              
            
!
999px

Console