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

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.

            
              <div id="page">
  <div class="prev">Prev Page</div>
  <div class="title">Title Here</div>
  <div class="next">Next Page</div>
  <div class="content">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam placerat libero id nisl interdum, vel mattis orci scelerisque. Aenean vestibulum ornare est, ut tincidunt nulla lobortis in. Cras imperdiet odio id mi aliquet lobortis. Ut auctor, nisi nec aliquet ornare, metus orci vestibulum ligula, eu lobortis est ipsum non risus. Cras nec dictum nisl, ac hendrerit ligula. Vestibulum arcu ligula, elementum ac posuere ac, condimentum nec tortor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse fringilla hendrerit fermentum. Integer mattis sapien et rutrum laoreet. Proin facilisis hendrerit odio, pretium sodales est lacinia ac. Sed eleifend molestie risus ac faucibus. Vivamus placerat dignissim risus vel efficitur. Proin lobortis consectetur justo. Maecenas ornare, odio a sollicitudin fringilla, est elit dignissim mauris, et tristique mauris ipsum in nunc. Fusce id quam et enim ultricies ultrices.</div>
  <div class="content">Cras quis urna venenatis, sollicitudin ligula ut, euismod mauris. Aenean at tortor sed nunc mollis lobortis. Sed aliquam, purus sit amet aliquet lacinia, tellus quam bibendum orci, vitae ultricies ante erat a augue. Maecenas tincidunt sit amet lacus ut malesuada. Nunc eu tempus nisl, eu tincidunt turpis. Maecenas aliquam lacus libero, non mollis velit tempor et. Sed euismod nisi sit amet viverra ultricies. Pellentesque in gravida massa. Sed sed semper massa. Mauris accumsan nulla ac efficitur semper. Phasellus maximus mi tellus, sit amet consequat urna facilisis non. Suspendisse ullamcorper hendrerit risus. Etiam feugiat mauris vitae purus varius, sit amet rutrum ligula volutpat.</div>
  <div class="content">Cras rutrum ligula lacus, vel commodo mi cursus a. Donec ligula massa, sagittis quis pulvinar eu, suscipit ac eros. Donec auctor, augue eu iaculis viverra, justo massa congue lorem, vitae consequat metus ante a nulla. Aenean quis elementum neque. Proin id justo leo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec a sagittis dui. Donec commodo justo sed tortor varius, ut malesuada arcu finibus.</div>
  <div class="content">Sed euismod tellus at ipsum laoreet maximus. Morbi finibus dignissim scelerisque. Morbi malesuada, lorem eu mattis malesuada, lacus odio cursus nisl, quis semper nisl sem in ex. Donec orci justo, fringilla ac mauris et, luctus dictum arcu. Nam imperdiet elit malesuada efficitur sagittis. Ut in placerat magna. Proin tempor nibh felis, dapibus molestie lorem feugiat eget. Nunc vel tellus sit amet sem finibus accumsan et in nisl. Maecenas pretium elementum quam, at blandit dolor. In at sem quam. Pellentesque at mi lorem. Nunc id nisi justo. Integer eleifend et erat in sagittis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam porttitor tortor sem, ut auctor nibh ultrices eget.</div>
  <div class="content">Nunc in ligula felis. Duis auctor bibendum massa, id elementum orci pretium at. Maecenas commodo urna lorem, a pretium metus dignissim sed. Pellentesque vel tincidunt nisl. Aenean dictum sed mi quis auctor. Quisque pulvinar vitae massa eleifend faucibus. Fusce lobortis risus quis diam lobortis, vel tincidunt mi viverra. Phasellus id enim interdum, elementum nulla nec, condimentum sem.</div>  
</div>

<div class="pagination"></div>

<div class="console"></div>
            
          
!
            
              @import "bourbon";

#page {
  width: 95%;
  max-width: 700px;
  //outline: 1px solid lime;
  min-height: 300px;
  margin: 20px auto 0;
}

.hide {
  visibility: hidden;
}

.pagination {
  width: 100%;
  max-width: 700px;
  margin: 10px auto;
  min-height: 50px;
  //outline: 1px solid tomato;
  text-align: center;
}

.title {
  font-size: 28px;
  margin-bottom: 10px;
  float: left;
  text-align: center;
  width: 58%;
  padding: 1%;
}

.prev, .next {
  //outline: 1px solid black;
  float: left;
  font-size: 28px;
  width: 18%;
  margin-bottom: 30px;
  text-align: center;
  cursor: pointer;
  background: #bbb;
  border-radius: 5px;
  padding: 1%;
}

.content {
  clear: both;
}

/* .console {
  width: 95%;
  max-width: 700px;
  margin: 10px auto;
  padding: 10px 0;
  outline: 1px solid cyan;
  text-align: center;
} */

.pageNum {
  padding: 5px 10px;
  border-radius: 100px;
  margin: 10px;
  display: inline-block;
  background: #ddd;
  cursor: pointer;
  
  &.navActive {
    background: #bbb;
    color: white;
  }
}
            
          
!
            
              var count = jQuery('.content').length;
var curPage = 1;

jQuery('.content').each(function(i) {
  jQuery(this).addClass('page'+(i+1));
  jQuery('.pagination').append('<span class="pageNum pageNum' + (i+1) + '">' + (i+1) + '</span>');
})

 if (curPage == 1) {
  if (count == curPage) { 
    jQuery('#page').addClass('noNav');
  }
  jQuery('.prev').addClass('hide');
  jQuery('.pageNum1').addClass('navActive');
}

jQuery('.content').not('.page'+curPage).hide();


jQuery('.next').click(function() {
  if (curPage != count) {
    jQuery('.content').hide();
    jQuery('.pageNum').removeClass('navActive');
    curPage++;
    jQuery('.content.page'+curPage).show();
    jQuery('.pageNum'+curPage).addClass('navActive');
    //jQuery('.console').html('count = ' + count + ' - current = ' + curPage);
  }
  
  if (curPage == count) {
    jQuery('.next').addClass('hide');
  }
  
  jQuery('.prev').removeClass('hide');
  
})

jQuery('.prev').click(function() {
  if (curPage != 1) {
    jQuery('.content').hide();
    jQuery('.pageNum').removeClass('navActive');
    curPage--;
    jQuery('.content.page'+curPage).show();
    jQuery('.pageNum'+curPage).addClass('navActive');
    //jQuery('.console').html('count = ' + count + ' - current = ' + curPage);
  }
  
  if (curPage == 1) {
    jQuery('.prev').addClass('hide');
  }
  
  jQuery('.next').removeClass('hide');
})

jQuery('.pageNum').click(function() {
  var pageClick = jQuery(this).text();
  jQuery('.pageNum').removeClass('navActive');
  jQuery(this).addClass('navActive');
  curPage = jQuery(this).text();
  jQuery('.content').hide();
  jQuery('.content.page'+curPage).show();
  
  if (curPage == 1) {
    jQuery('.prev').addClass('hide');
    jQuery('.next').removeClass('hide');
  } else if (curPage == count) {
    jQuery('.prev').removeClass('hide');
    jQuery('.next').addClass('hide');
  } else {
    jQuery('.prev').removeClass('hide');
    jQuery('.next').removeClass('hide');
  }
})

//jQuery('.console').append('count = ' + count + ' - current = ' + curPage);
            
          
!
999px
🕑 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.
Loading ..................

Console