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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                

<section class="typoKontur">
  <h1 id="A" data-scroll-speed="1">You can smell it ...</h1>
</section>

<section>
  <div id="copy" data-scroll-speed="1">
    <h1 >The port of Hamburg</h1>
    <h1 >is the world's largest</h1>
    <h1 >trading place</h1>
    <h1 >for coffee.</h1>
  </div>
  <div id="copy" data-scroll-speed="2"> 
    <h1 >The old "Speicherstadt" was</h1>
    <h1 >the storage for coffee ...</h1>
     
  </div>

</section>

<section class="typoKontur">

</section>

<section>
	<h1 >Hamburg is my hometown.</h1>
</section>
              
            
!

CSS

              
                body { 
  margin: 0;
  font-family: 'Work Sans', sans-serif;
}

h1 {
  margin: 0;
  line-height: 6vw;
}
#copy{
  position: relative;
  top: 50%;
}
section { 
  height: 100vh; 
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center; 
  flex-direction: column;
  padding: 2vw;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  font-size: 3vw; 
}
section:first-of-type { 
  text-transform: uppercase;
  font-size: 4vw;
}
section.typoKontur { 
  color: #fff;
  text-shadow: 0 0 5px rgba(0,0,0,0.6); 
}
section:nth-of-type(even) { 
  background: #2d1212;
  color: white;
  height: 80vh;
  overflow: hidden;
}
section:nth-of-type(1) { 
  background-image: url(https://unsplash.it/1000/450?image=766); 
  background-position: center;
}
section:nth-of-type(1) h1{ 
  margin: 0;
  line-height: 6vw;
  padding: 10px;
  background: #2b0000;
}
section:nth-of-type(3) { 
  background-image: url(https://unsplash.it/800/450?image=826); 
  background-position: center;
}
section:nth-of-type(4) { 
  height: 130px;
}
              
            
!

JS

              
                // Toni Almeida of Portugal created a brilliant demo of individual scroll speed:
// https://stackoverflow.com/questions/7408100/can-i-change-the-scroll-speed-using-css-or-jquery

if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;

function wheel(event) {
    var delta = 0;
    if (event.wheelDelta) delta = event.wheelDelta / 120;
    else if (event.detail) delta = -event.detail / 3;

    handle(delta);
    if (event.preventDefault) event.preventDefault();
    event.returnValue = false;
}


function handle(delta) {
    var time = 1200;
	  var distance = 70;
    
    $('html, body').stop().animate({
        scrollTop: $(window).scrollTop() - (distance * delta)
    }, time );
}


// https://codepen.io/JTParrett/pen/BkDie
// jQuery different scroll speeds

$.fn.moveIt = function(){
  var $window = $(window);
  var instances = [];
  
  $(this).each(function(){
    instances.push(new moveItItem($(this)));
  });
  
  window.onscroll = function(){
    var scrollTop = $window.scrollTop();
    instances.forEach(function(inst){
      inst.update(scrollTop);
    });
  }
}

var moveItItem = function(el){
  this.el = $(el);
  this.speed = parseInt(this.el.attr('data-scroll-speed'));
};

moveItItem.prototype.update = function(scrollTop){
  this.el.css('transform', 'translateY(' + -(scrollTop / this.speed) + 'px)');
};

// Initialization
$(function(){
  $('[data-scroll-speed]').moveIt();
});
              
            
!
999px

Console