Pen Settings

HTML

CSS

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.

+ 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

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.

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

              
                <img
  id="zoom-default"
  src="https://images.unsplash.com/photo-1441794016917-7b6933969960?dpr=1&auto=compress,format&fit=crop&w=1920&h=&q=80&cs=tinysrgb&crop="
  alt="Zoom with default options"
>

<figure>
  <img
    id="zoom-margin"
    src="https://images.unsplash.com/photo-1475778057357-d35f37fa89dd?dpr=1&auto=compress,format&fit=crop&w=1920&h=&q=80&cs=tinysrgb&crop="
    alt="Zoom with margin"
  >
  <figcaption>Zoom with margin</figcaption>
</figure>

<figure>
  <img
    id="zoom-background"
    src="https://images.unsplash.com/photo-1439792675105-701e6a4ab6f0?dpr=1&auto=compress,format&fit=crop&w=1920&h=&q=80&cs=tinysrgb&crop="
    alt="Zoom with background color"
  >
  <figcaption>Zoom with background color</figcaption>
</figure>

<figure>
  <img
    id="zoom-scrollOffset"
    src="https://images.unsplash.com/photo-1495214783159-3503fd1b572d?dpr=1&auto=compress,format&fit=crop&w=1920&h=&q=80&cs=tinysrgb&crop="
    alt="Zoom without scroll effect"
  >
  <figcaption>Zoom without scroll offset</figcaption>
</figure>

<figure>
  <img
    id="zoom-metaClick"
    src="https://images.unsplash.com/photo-1502056247561-73539df36440?dpr=1&auto=compress,format&fit=crop&w=1920&h=&q=80&cs=tinysrgb&crop="
    alt="Zoom without meta click"
  >
  <figcaption>Zoom without meta click</figcaption>
</figure>

<figure>
  <img
    id="zoom-trigger"
    src="https://images.unsplash.com/photo-1501163109389-abf37ca1276a?dpr=1&auto=compress,format&fit=crop&w=1920&h=&q=80&cs=tinysrgb&crop="
    alt="Zoom to trigger"
  >
  <figcaption>
    <button id="btn-trigger" class="button">Trigger the zoom</button>
  </figcaption>
</figure>

<figure>
  <img
    id="zoom-detach"
    src="https://images.unsplash.com/photo-1464688768931-1c8024786293?dpr=1&auto=compress,format&fit=crop&w=1920&h=&q=80&cs=tinysrgb&crop="
    alt="Zoom detached after being zoomed once"
  >
  <figcaption>Zoom detached after being zoomed once</figcaption>
</figure>

<figure>
  <img
    src="https://images.unsplash.com/photo-1500897975290-fa277274fdb2?dpr=1&auto=compress,format&fit=crop&w=100&h=&q=80&cs=tinysrgb&crop="
    data-zoom-target="https://images.unsplash.com/photo-1500897975290-fa277274fdb2?dpr=1&auto=compress,format&fit=crop&w=720&h=&q=80&cs=tinysrgb&crop="
    alt="HD zoom on thumb image"
    data-zoom
  >
  <figcaption>HD zoom on thumb image</figcaption>
</figure>

              
            
!

CSS

              
                body {
  max-width: 800px;
  margin: auto;
  font-family: sans-serif;
}

img {
  max-width: 100%;
}

figure {
  text-align: center;
}

figcaption {
  padding: 12px 0;
  margin-bottom: 24px;
  font-weight: bold;
  color: #777;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 3px;
  padding: 16px 24px;
  background-color: #03a9f4;
  color: #fff;
}

              
            
!

JS

              
                mediumZoom("#zoom-default");
mediumZoom("#zoom-margin", {
  margin: 48
});
mediumZoom("#zoom-background", {
  background: "#131711"
});
mediumZoom("#zoom-scrollOffset", {
  scrollOffset: 0
});
mediumZoom("#zoom-metaClick", {
  metaClick: false
});
mediumZoom("[data-zoom]");

var zoomToTrigger = mediumZoom("#zoom-trigger");
var button = document.querySelector("#btn-trigger");
button.addEventListener("click", function() {
  zoomToTrigger.show();
});

var zoomToDetach = mediumZoom("#zoom-detach");
zoomToDetach.addEventListeners("hidden", zoomToDetach.detach);

              
            
!
999px

Console