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.2 - Preview</h2>

<p>&nbsp;</p>

<div class="row">

  <div class="col-md-4">
    <form>

      <div class="form-group">
        <label for="animationEffect">Open/close animation type</label>
        <select id="animationEffect" class="form-control">
          <option value="zoom">zoom</option>
          <option value="fade">fade</option>
          <option value="slide">slide</option>
          <option value="rotate">rotate</option>
          <option value="circular">circular</option>
          <option value="tube">tube</option>
          <option value="zoom-in-out">zoom-in-out</option>
          <option value="" style="font-style:italic;color:#888;">none</option>
        </select>
      </div>

      <div class="form-group">
        <label for="transitionEffect">Transition effect between slides</label>
        <select id="transitionEffect" class="form-control">
          <option value="fade">fade</option>
          <option value="slide">slide</option>
          <option value="rotate">rotate</option>
          <option value="circular">circular</option>
          <option value="tube">tube</option>
          <option value="zoom-in-out">zoom-in-out</option>
          <option value="" style="font-style:italic;color:#888;">none</option>
        </select>
      </div>






      <div class="form-row mt-5">
        <div class="form-group col-md-3">
          Buttons
        </div>

        <div class="form-group col-md-9">


          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input buttons" type="checkbox" value="slideShow" checked="checked"> SlideShow
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input buttons" type="checkbox" value="fullScreen" checked="checked"> Fullscreen
            </label>

          </div>
          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input buttons" type="checkbox" value="thumbs" checked="checked"> Thumbnails
            </label>

          </div>
          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input buttons" type="checkbox" value="download"> Download
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input buttons" type="checkbox" value="zoom"> Zoom
            </label>
          </div>
          
          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input buttons" type="checkbox" value="share" checked="checked"> Share
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input buttons" type="checkbox" value="arrowLeft"> Left arrow
            </label>
          </div>
          
          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input buttons" type="checkbox" value="arrowRight"> Right arrow
            </label>
          </div>
          
        </div>

      </div>


      <div class="form-row">
        <div class="form-group col-md-3">
          Display
        </div>

        <div class="form-group col-md-9">

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input type="checkbox" class="form-check-input toggle" id="arrows" value="1" checked="checked"> 
              Navigation arrows
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input type="checkbox" class="form-check-input toggle" id="infobar" value="1" checked="checked"> 
              Counter
            </label>
          </div>
          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input type="checkbox" class="form-check-input toggle" id="thumbs" value="1"> 
              Thumbnails
            </label>
          </div>
        </div>

      </div>

      <div class="form-row">
        <div class="form-group col-md-3">
          Language
        </div>

        <div class="form-group col-md-9">

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="radio" name="lang" value="en" checked="checked"> English
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="radio" name="lang" value="de"> German
            </label>
          </div>
        </div>
      </div>

      <div class="form-group">
        <button id="toggleClass" type="button" class="btn">Set custom class</button>
      </div>

    </form>

  </div>

  <div class="col-md-7">
    <p class="imglist">
      <a href="https://c1.staticflickr.com/9/8148/29324593462_abebaddc38_k.jpg" data-fancybox="images">
        <img src="https://c1.staticflickr.com/9/8148/29324593462_f890687b7a_m.jpg" />
      </a>

      <a href="https://c2.staticflickr.com/6/5499/30972532232_051e1dc57e_h.jpg" data-fancybox="images">
        <img src="https://c2.staticflickr.com/6/5499/30972532232_e9a298a0c5_m.jpg" />
      </a>

      <a href="https://farm1.staticflickr.com/560/31434966252_8e1bc946da_b_d.jpg" data-fancybox="images">
        <img src="https://farm1.staticflickr.com/560/31434966252_8e1bc946da_m_d.jpg">
      </a>

      <a href="https://c1.staticflickr.com/1/357/31876784275_12286240d4_h.jpg" data-fancybox="images">
        <img src="https://c1.staticflickr.com/1/357/31876784275_fbc9696913_m.jpg" />
      </a>

      <a href="https://farm1.staticflickr.com/582/32752534825_4b35b2df81_o_d.jpg" data-fancybox="images">
        <img src="https://farm1.staticflickr.com/582/32752534825_c25321a594_m_d.jpg" />
      </a>

      <a href="https://farm3.staticflickr.com/2859/33395734202_522f9d8efd_k_d.jpg" data-fancybox="images">
        <img src="https://farm3.staticflickr.com/2859/33395734202_15a81c4ef3_m_d.jpg" />
      </a>

      <a href="https://farm4.staticflickr.com/3953/15594397982_477385f90d_b_d.jpg" data-fancybox="images">
        <img src="https://farm4.staticflickr.com/3953/15594397982_477385f90d_m_d.jpg" />
      </a>
    </p>

  </div>

</div>
              
            
!

CSS

              
                .myClass .fancybox-bg {
  background-color: #fff;
}

.myClass.fancybox-is-open .fancybox-bg {
  opacity: 1;
}

.myClass .fancybox-button,
.myClass .fancybox-navigation button {
  background: transparent;
  color: #444;
  padding: 8px;
}

.myClass .fancybox-button:hover:not([disabled]) {
	color: #000;
}

.myClass .fancybox-navigation button::before {
  background: transparent;
}

.myClass .fancybox-share {
  background: #fff;
}

.myClass .fancybox-close-small:after {
  font-size:25px;
}
              
            
!

JS

              
                $("select").change(function() {
  var opt = $(this).attr("id");
  var val = $(this).val();

  $.fancybox.defaults[ opt ] = val === "" ? false : val;

  // Make "fade" transiton faster than others
  if ( opt === 'transitionEffect' ) {
    $.fancybox.defaults[ 'transitionDuration' ] = opt === 'fade' ? 330 : 550;
  }
});

$("input[type=radio][name=lang]").on("change", function() {
  $.fancybox.defaults.lang = $(this).val();
});

$(".toggle").change(function() {
  if ( this.id === 'thumbs' ) {
    $.fancybox.defaults.thumbs.autoStart = this.checked ? true : false;
  } else {
    $.fancybox.defaults[this.id] = this.checked ? true : false;
  }
});

$(".buttons").change(function() {
  var buttonArr = $('input:checkbox:checked.buttons').map(function () {
    return this.value;
  }).get();

  buttonArr.push('close');

  $.fancybox.defaults.buttons = buttonArr;
});

$("#toggleClass").on('click', function() {
  var setCustom = $.fancybox.defaults.baseClass === '';

  $.fancybox.defaults.baseClass = setCustom ? 'myClass' : '';

  $(this).html( setCustom ? 'Remove custom class' : 'Set custom class' );
});
              
            
!
999px

Console