cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <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>
  </div>
</div>

<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"],
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 = (/webkit/i.test(navigator.userAgent) || document.compatMode == 'BackCompat' ? 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(){
    KUTE.to('window', {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('window', {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";
    container.appendChild(bg);
}


            
          
!
999px
Loading ..................

Console