LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent bibendum, lorem vel tincidunt imperdiet, nibh elit laoreet felis, a bibendum nisl tortor non orci. Donec pretium fermentum felis, quis aliquet est rutrum ut. Integer quis massa ut lacus viverra pharetra in eu lacus. Aliquam tempus odio adipiscing diam pellentesque rhoncus. Curabitur a bibendum est. Mauris vehicula cursus risus id luctus. Curabitur accumsan venenatis nibh, non egestas ipsum vulputate ac. Vivamus consectetur dolor sit amet enim aliquet eu scelerisque ipsum hendrerit. Donec lobortis suscipit vestibulum. Nullam luctus pellentesque risus in ullamcorper. Nam neque nunc, mattis vitae ornare ut, feugiat a erat. Ut tempus iaculis augue vel pellentesque.

Vestibulum nunc massa, gravida quis porta nec, feugiat id metus. Nunc ac arcu dolor, quis vestibulum leo. Cras viverra mollis ipsum, non rhoncus lectus aliquam et. Morbi faucibus purus sit amet lacus aliquet elementum. Donec sit amet posuere enim. Cras in eros id tortor fringilla ultricies. Mauris faucibus ullamcorper velit, pulvinar varius odio eleifend eu. Quisque id odio metus. Morbi adipiscing ultricies posuere. Pellentesque elementum porttitor eros in molestie. Maecenas ut leo quis nisi tempor tincidunt.

Donec nunc ligula, vulputate quis mollis eu, interdum quis libero. Donec nulla ante, facilisis sit amet vulputate at, tincidunt a velit. Maecenas vestibulum, nulla sed tincidunt viverra, lorem turpis aliquam urna, ut pretium orci purus consequat augue. Etiam a enim orci, vitae pulvinar odio. In elit urna, tincidunt a pellentesque et, scelerisque at nibh. Sed nec est sapien. Aliquam ullamcorper eros eu quam ultrices vel faucibus eros interdum. Etiam mattis eleifend sapien, eu iaculis massa feugiat sed. Aliquam erat volutpat. Vivamus facilisis ultricies eros, a pretium purus mollis id. Sed dapibus elit ut neque rutrum dignissim. Nulla eros nisl, venenatis quis rhoncus sit amet, molestie nec nisl. Pellentesque vel neque sapien, et sagittis nulla.

Aliquam eu iaculis mauris. Etiam arcu lectus, imperdiet sit amet volutpat vitae, commodo sed nibh. Fusce faucibus tempor cursus. Donec ut ligula tortor. Maecenas malesuada, diam vitae pharetra dictum, erat ante iaculis risus, sed sollicitudin nisl nisl vel metus. Nulla libero augue, convallis nec luctus id, iaculis nec urna. Cras vitae mi ut augue ultricies tempus.

Vestibulum euismod vehicula sollicitudin. Duis nibh justo, rhoncus ac ullamcorper nec, rutrum sit amet leo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum varius posuere nisi sed aliquet. Etiam dolor nisi, placerat vel congue tempus, posuere sed erat. Phasellus turpis eros, molestie sed consequat in, pretium at erat. In sed faucibus metus. Vestibulum fermentum libero nec eros fermentum dapibus. Duis nec libero eros. Pellentesque magna ligula, sagittis dictum fringilla at, posuere porttitor sem. Donec aliquam, ipsum quis pulvinar dapibus, augue sem viverra sapien, nec tempus odio nulla ac metus. Nunc ut augue mi, nec consequat urna.

CSS
.Note {
  background: #F2E89F;
  border: solid 1px #E1D859;
  padding: 10px;
  border-radius: 5px;
}
/* Basic setup */
.pageable-container {
  overflow: hidden;
}
.pageable {
  width: 200%;
  /* Double wide to accomodate two items side-by-side */
}
.pageable-page {
  opacity: 0;
  float: left;
  width: 50%;
  /* Half of the double wide container, so 100% of the original container */
  margin-right: -50%;
  /* Keeps the items stacked on top of each other. We'll use transforms later for the sliding effect. */
  margin-bottom: -100%;
  /* Makes the item essentially heightless */
  -webkit-transition: all 800ms ease-in-out, margin-bottom 2s ease-out;
  transition: all 800ms ease-in-out, margin-bottom 2s ease-out;
  -webkit-transition-delay: 0, 800ms;
          transition-delay: 0, 800ms;
  /* Delay to prevent the margin from collapsing too soon and making the container go to 0 height */
}
.pageable-page.is-Current {
  z-index: 5;
  opacity: 1;
  margin-bottom: 0%;
  -webkit-transition-duration: 800ms, 800ms;
          transition-duration: 800ms, 800ms;
  -webkit-transition-delay: 0;
          transition-delay: 0;
}
/* Horizontal Slide */
.pageable.is-Horizontal .pageable-page {
  -webkit-transform: translateX(100%);
          transform: translateX(100%);
}
.pageable.is-Horizontal .pageable-page.is-Before {
  -webkit-transform: translateX(-100%);
          transform: translateX(-100%);
}
.pageable.is-Horizontal .pageable-page.is-Current {
  -webkit-transform: translateX(0);
          transform: translateX(0);
}
/* Vertical Slide */
.pageable.is-Vertical .pageable-page {
  -webkit-transform: translateY(100%);
          transform: translateY(100%);
}
.pageable.is-Vertical .pageable-page.is-Before {
  -webkit-transform: translateY(-100%);
          transform: translateY(-100%);
}
.pageable.is-Vertical .pageable-page.is-Current {
  -webkit-transform: translateY(0);
          transform: translateY(0);
}
/* Presentational Styles */
body {
  background: #000;
  color: #555;
  padding: 2em;
  margin: 0;
}
.pageable-container {
  border: solid 5px #e74c3c;
  background: #aaa;
}
h1,
h2 {
  margin: 0;
}
code {
  background: #ccc;
  border-radius: 5px;
  padding: 0em 0.5em;
}
.menu {
  background: #eee;
  padding: 2em;
  color: #444;
}
.menu :last-child {
  margin-bottom: 0;
}
.menu dt {
  font-weight: bold;
}
.menu dd {
  font-style: italic;
}
.Button {
  display: inline-block;
  vertical-align: bottom;
  margin-right: 1em;
  background: #e74c3c;
  color: #FFF;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  border: none;
  font-size: 11px;
  text-transform: uppercase;
  -webkit-transition: all 500ms ease;
  transition: all 500ms ease;
  padding: 1em 2em;
}
.Button.Alt {
  background: #888;
  padding: 0.5em 1em;
}
.Button[disabled] {
  background: #555;
  color: #999;
}
JS
var currentClass = "is-Current",
    beforeClass = "is-Before",
    $pageable = $(".pageable").addClass("is-Horizontal"),
    $pages = $pageable.children().addClass("pageable-page"),
    $current,
    changePage = function(index) {
      console.log("index",index,$pages.length);

      if ( index >= $pages.length - 1 ) {
        $nextButton.attr("disabled",true);
      } else {
        $nextButton.removeAttr("disabled");
      }

      if ( index <= 0 ) {
        $prevButton.attr("disabled",true);
      } else {
        $prevButton.removeAttr("disabled");
      }

      if ( index <= $pages.length - 1 &&  index >= 0 ) {
        var $newPage = $($pages.get(index));

        $pages
        .not(':eq(' + index + ')')
        // Prevent transitions on items that aren't changing
        .css('transition', 'none')
        // Accessibility attributes
        .attr("aria-hidden",true)
        .attr("tabindex","-1")
        // Toggle beforeClasses
        .removeClass(beforeClass)
        .filter(':lt(' + index + ')')
        .addClass(beforeClass);

        console.log("newPage",$newPage,index);

        if ( $current ) {
          $current
          .css('transition', '')
          .removeClass(currentClass);
        }

        $current = $newPage
        .css('transition', '')
        .attr("aria-hidden",false)
        .attr("tabindex","")
        .addClass(currentClass);
      }
    },
    
    $buttons = $('
').prependTo("body"), $prevButton = $('') .appendTo($buttons) .on("click",function(){ changePage($pages.index($current) - 1); }), $nextButton = $(' ') .appendTo($buttons) .on("click",function(){ changePage($pages.index($current) + 1); }), $toggleButton = $('') .appendTo($buttons) .on("click",function(){ $pageable .toggleClass("is-Horizontal is-Vertical"); var txt = ( $pageable.hasClass("is-Horizontal") ? 'Switch to Vertical' : 'Switch to Horizontal' ); $toggleButton.text(txt); }); changePage(0); $nextButton
Host Instantly Drag and Drop Website Builder

 

Description

Basic slider demonstrating a method of animating/transitioning the height in a height: auto setting.
Term
Mon, 11/27/2017 - 22:07

Related Codes

Pen ID
Pen ID
Pen ID