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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <h2>In-page Content</h2>
<a href="#" class="title-link js-show-content">Show hidden content</a>
<div class="js-hidden-content">
  <p>Lorem ipsum dolor sit amet, consectetur.</p>
  <p>Ut laudantium similique animi ea incidunt.</p>
  <p>Ad ab praesentium corrupti doloribus sequi.</p>
  <p>Magni error in facere similique sunt!</p>
</div>

<a href="#" class="title-link js-show-content">Show hidden content</a>
<div class="js-hidden-content">
  <p>Lorem ipsum dolor sit amet, consectetur.</p>
  <p>Ut laudantium similique animi ea incidunt.</p>
  <p>Ad ab praesentium corrupti doloribus sequi.</p>
  <p>Magni error in facere similique sunt!</p>
</div>

<a href="#" class="title-link js-show-content">Show hidden content</a>
<div class="js-hidden-content">
  <p>Lorem ipsum dolor sit amet, consectetur.</p>
  <p>Ut laudantium similique animi ea incidunt.</p>
  <p>Ad ab praesentium corrupti doloribus sequi.</p>
  <p>Magni error in facere similique sunt!</p>
</div>

<a href="#" class="title-link js-show-content">Show hidden content</a>
<div class="js-hidden-content">
  <p>Lorem ipsum dolor sit amet, consectetur.</p>
  <p>Ut laudantium similique animi ea incidunt.</p>
  <p>Ad ab praesentium corrupti doloribus sequi.</p>
  <p>Magni error in facere similique sunt!</p>
</div>

<hr>
  
<h2>Nav with Subnav</h2>
  
<nav>
  <ul>
    <li>Lorem ipsum dolor.</li>
    <li>Est ipsa laboriosam.</li>
    <li class="js-show-content"><a href="#">Quibusdam quas minima!</a>
      <ul class="js-hidden-content">
        <li>Lorem ipsum dolor.</li>
        <li>Facere et vero.</li>
        <li>Maiores soluta assumenda!</li>
        <li>Nemo iste qui.</li>
        <li>Porro sequi facilis.</li>
      </ul>
    </li>
    <li>Pariatur recusandae vero.</li>
    <li class="js-show-content"><a href="#">Sint porro aliquid.</a>
      <ul class="js-hidden-content">
        <li>Lorem ipsum dolor.</li>
        <li>Facere et vero.</li>
        <li>Maiores soluta assumenda!</li>
        <li>Nemo iste qui.</li>
        <li>Porro sequi facilis.</li>
      </ul>
    </li>
  </ul>
</nav>
  
<hr>
  
<h2>Open/Close Pulldown</h2>

<div class="js-hidden-content">
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius vero.</p>
  <p>Esse vero maxime eaque. Modi earum quidem ratione amet in!</p>
  <p>Cumque fuga mollitia tenetur itaque eum aliquid minima eius ipsam.</p>
  <p>Corporis dolorum sequi quibusdam illum expedita doloribus debitis? Eos facere?</p>
  <p>Rerum eaque perferendis! Doloribus ducimus inventore placeat repudiandae eius asperiores?</p>
</div>
<a class="js-show-content" href="#">Open</a>
<br>
<div class="js-hidden-content">
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius vero.</p>
  <p>Esse vero maxime eaque. Modi earum quidem ratione amet in!</p>
  <p>Cumque fuga mollitia tenetur itaque eum aliquid minima eius ipsam.</p>
  <p>Corporis dolorum sequi quibusdam illum expedita doloribus debitis? Eos facere?</p>
  <p>Rerum eaque perferendis! Doloribus ducimus inventore placeat repudiandae eius asperiores?</p>
</div>
<a class="js-show-content" href="#" data-alt-title="Close">Open</a>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  padding: 1em;
}

p {
  margin-bottom: 1.4em;
}

.title-link {
  display: block;
  margin-bottom: 1.4em;
}

.js-hidden-content {
  // visually hidden?
  
}

.is-hidden {
  text-indent: 100%;
  white-space: nowrap;
  overflow: hidden;
  height: 0;
}

.is-active {
  font-weight: bold;
}
              
            
!

JS

              
                var Reveal = (function($) {
  "use strict";
  
	var accordion = {};
	var accordionComponents = 0;
  var activeTrigger;
  var triggers;
  var triggerPos;
  var hiddenContent;
  var activeContent;
  var isAccordion = true; // should opening an element close the others or leave open? Need to think about how this will work - data-attr?
  
	function addHandlers() {
    triggers.on("click", getTrigger);
  }
  
  function getTrigger(e) {
    e.preventDefault();
    activeTrigger = this; // investigate how "this" works in strict mode
    triggerPos = triggers.index(activeTrigger);
    
    isAccordion ? showContentAccordion() : showContent();
  }
  
  function hideContent() {
    hiddenContent.addClass("is-hidden");
    triggers.removeClass("is-active");
  }
  
  function showContent() {
   
   $(activeTrigger).toggleClass("is-active");
    activeContent = hiddenContent[triggerPos];
    $(activeContent).toggleClass("is-hidden");
  }
  
  function showContentAccordion() {
    
    if($(activeTrigger).hasClass("is-active")) {
      hideContent();
    }
    else {
      hideContent();
      $(activeTrigger).addClass("is-active");
      activeContent = hiddenContent[triggerPos];
      $(activeContent).removeClass("is-hidden");
    }
  }

	//accordion.moduleProperty = 1;
  
	accordion.init = function() {

    accordionComponents = $(".js-show-content").length;
    
    if(accordionComponents > 0) {
      triggers = $(".js-show-content");
      hiddenContent = $(".js-hidden-content");
      hideContent();
      addHandlers();
    }
    
	};

	return accordion;
}(jQuery));


$(document).ready(function() {
  Reveal.init();
});
              
            
!
999px

Console