Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div id="container">
    <div class="box">
      <h1>Click Anywhere to Scroll</h1>
      <p>Quickly aggregate B2B users and worldwide potentialities. Progressively plagiarize resource-leveling e-commerce through resource-leveling core competencies. Dramatically mesh low-risk high-yield alignments before transparent e-tailers.</p>

      <p>Appropriately empower dynamic leadership skills after business portals. Globally myocardinate interactive supply chains with distinctive quality vectors. Globally revolutionize global sources through interoperable services.</p>

      <p>Enthusiastically mesh long-term high-impact infrastructures vis-a-vis efficient customer service. Professionally fashion wireless leadership rather than prospective experiences. Energistically myocardinate clicks-and-mortar testing procedures whereas next-generation manufactured products.</p> 

      <p>Dynamically target high-payoff intellectual capital for customized technologies. Objectively integrate emerging core competencies before process-centric communities. Dramatically evisculate holistic innovation rather than client-centric data.</p>

      <p>Progressively maintain extensive infomediaries via extensible niches. Dramatically disseminate standardized metrics after resource-leveling processes. Objectively pursue diverse catalysts for change for interoperable meta-services.</p>

<button type="button" id="toBottom">To Bottom</button>
<button type="button" id="toTop">To Top</button>
              /*scrollable element styling*/

.box {
  width: 550px;
  height: 160px;
  margin-left: -240px;
  position: fixed;
  top: 20px;
  left: 50%;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
  font-family: sans-serif;
  border-radius: 10px 0 0 10px;
  background: #ffd626;
  padding: 15px 20px;
  overflow: auto;
  cursor: pointer

.bg {
  width: 100%;
  height: 150px;
  display: block;

body {
  margin: 0

/*some button styling*/

button {
  position: fixed;
  left: 25px;
  border: 0;
  background: #fff;
  border-radius: 5px;
  line-height: 20px;
  cursor: pointer

#toTop {
  bottom: 25px;

#toBottom {
  top: 25px;

body[data-tweening="scroll"] * { pointer-events: none !important; }
              // util functions
function random(min,max){
  return Math.floor(Math.random() * (max - min + 1)) + min;

//grab some scrollable element
var box = document.querySelector('.box');

// grab the real scrollable element in window
var bd = document.body;
var htm = document.getElementsByTagName('HTML')[0];
var sct = /(Mac|EDGE)/i.test(navigator.userAgent) ? bd : htm;
//grab some buttons and stuff
var toTop = document.getElementById('toTop');
var toBottom = document.getElementById('toBottom');
var container = document.getElementById('container');

//scroll the box to top / bottom
box.addEventListener('click', boxHandler, false);

function boxHandler(){
    var value = box.scrollTop === 0 ? parseInt(box.scrollHeight-200) : 0;
    KUTE.to(box, {scroll: value}, {easing: 'easingCubicOut'}).start()

//scroll the window
toTop.addEventListener('click', topHandler, false);
function topHandler(){
    sct.scrollTop && KUTE.to(sct, {scroll: 0}, {easing: 'easingCubicOut', duration: 1500}).start()

toBottom.addEventListener('click', bottomHandler, false);
function bottomHandler(){ 
    var sv = sct.scrollHeight - sct.clientHeight, 
        scrollValue = sv === 0 ? sct.clientHeight : sv;
    KUTE.to(sct, {scroll: scrollValue}, {easing: 'easingCubicOut',duration: 1500}).start()

// create some more space to scroll
for (var i=0;i<20;i++ ){
    var bg = document.createElement('DIV'), r=random(0,255), g=random(0,255), b = random(0,255);
    bg.style.backgroundColor = 'rgb('+r+','+g+','+b+')';
    bg.className = "bg";

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.