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

              
                <nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Home</a></li>
      <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">Articles
        <span class="caret"></span></a>
        <ul class="dropdown-menu" id="articles-dropdown">
<!--      <li><a href="#">Article 1</a></li> -->
        </ul>
      </li>
      <li><a href="#">About us</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
  </div>
</nav>

<div class="container">
  <h3>Hybrid navigation</h3>
  <p>Most of the naviagation is hardcoded in your app but the links under <i>Articles</i> are dynamically generated based on all published content items of the <i>Article</i> content type in your project.</p>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                // Use jQuery to request the content item using Kentico Cloud Delivery API.
$.ajax({
  type: "GET",
  // limit the elements you retrieve in the Article type content items to Title and URL
  url: "https://deliver.kenticocloud.com/8d20758c-d74c-4f59-ae04-ee928c0816b7/items?system.type=article&elements=title%2Curl",
  dataType: "json",
  success: processData,
  error: function() {
    alert("failed");
  }
});

// Process the retrieved data and display it on the page.
function processData(data) {
  for(let item of data.items) {
    let title = item.elements.title.value;
    let url = item.elements.url.value;
    $("#articles-dropdown").append("<li><a href='#articles/"+ url +"' title='articles/"+ url +"'>" + title + "</a></li>")
  }
}

              
            
!
999px

Console