css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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="output">
</div>

<div class="divWrapper"><h1>BIG TEXT</h1></div>
<div class="divWrapper"><div class="sliderWrapper">
  <div class="sliderImage load">
   <div class="sliderImageWrapper">
    <div data-title="Dock" data-text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Hic ambiguo ludimur. Quae similitudo in genere etiam humano apparet. Hoc est non dividere, sed frangere. Neminem videbis ita laudatum, ut artifex callidus comparandarum voluptatum diceretur. Ex quo illud efficitur, qui bene cenent omnis libenter cenare, qui libenter, non continuo bene. Duo Reges: constructio interrete. Tu autem negas fortem esse quemquam posse, qui dolorem malum putet. Quamquam te quidem video minime esse deterritum. Quid, quod res alia tota est? Nam, ut sint illa vendibiliora, haec uberiora certe sunt." class="sliderImageItem">
      <img src="https://unsplash.it/800/500?image=230" />
    </div>
    <div data-title="Stump" data-text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Hic ambiguo ludimur. Quae similitudo in genere etiam humano apparet. Hoc est non dividere, sed frangere. Neminem videbis ita laudatum, ut artifex callidus comparandarum voluptatum diceretur. Ex quo illud efficitur, qui bene cenent omnis libenter cenare, qui libenter, non continuo bene." class="sliderImageItem">
      <img src="https://unsplash.it/800/500?image=330" />
    </div>
    <div data-title="Forest" data-text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Hic ambiguo ludimur. Quae similitudo in genere etiam humano apparet. Hoc est non dividere, sed frangere. Tu autem negas fortem esse quemquam posse, qui dolorem malum putet. Quamquam te quidem video minime esse deterritum. Quid, quod res alia tota est? Nam, ut sint illa vendibiliora, haec uberiora certe sunt." class="sliderImageItem">
      <img src="https://unsplash.it/800/500?image=560" />
    </div>
    <div data-title="Plant" data-text="Ex quo illud efficitur, qui bene cenent omnis libenter cenare, qui libenter, non continuo bene. Duo Reges: constructio interrete. Tu autem negas fortem esse quemquam posse, qui dolorem malum putet. Quamquam te quidem video minime esse deterritum. Quid, quod res alia tota est? Nam, ut sint illa vendibiliora, haec uberiora certe sunt." class="sliderImageItem">
      <img src="https://unsplash.it/800/500?image=530" />
    </div>
        <div data-title="Snow" data-text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Hic ambiguo ludimur. Quae similitudo in genere etiam humano apparet. Hoc est non dividere, sed frangere. Neminem videbis ita laudatum, ut artifex callidus comparandarum voluptatum diceretur. Ex quo illud efficitur, qui bene cenent omnis libenter cenare, qui libenter, non continuo bene. Duo Reges: constructio interrete. Quid, quod res alia tota est? Nam, ut sint illa vendibiliora, haec uberiora certe sunt." class="sliderImageItem">
      <img src="https://unsplash.it/800/500?image=730" />
    </div>
     <div data-title="Fog" data-text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Hic ambiguo ludimur. Quae similitudo in genere etiam humano apparet. Hoc est non dividere, sed frangere. Neminem videbis ita laudatum, ut artifex callidus comparandarum voluptatum diceretur. Ex quo illud efficitur, qui bene cenent omnis libenter cenare, qui libenter, non continuo bene.  Quamquam te quidem video minime esse deterritum. Quid, quod res alia tota est? Nam, ut sint illa vendibiliora, haec uberiora certe sunt." class="sliderImageItem">
      <img src="https://unsplash.it/800/500?image=932" />
    </div>
   </div>
  </div>
  <div class="sliderText">
    <div class="sliderTextFloat">
      <div class="sliderTextWrapper">
        <h3 class="sliderSubText">Most Important Category</h3>
    <h2 class="sliderTitleText">Super Important <span></span></h2>
    <p> data-text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Hic ambiguo ludimur. Quae similitudo in genere etiam humano apparet. Hoc est non dividere, sed frangere. Neminem videbis ita laudatum, ut artifex callidus comparandarum voluptatum diceretur. Ex quo illud efficitur, qui bene cenent omnis libenter cenare, qui libenter, non continuo bene. Duo Reges: constructio interrete. Tu autem negas fortem esse quemquam posse, qui dolorem malum putet. Quamquam te quidem video minime esse deterritum. Quid, quod res alia tota est? Nam, ut sint illa vendibiliora, haec uberiora certe sunt."</p>
    <a class="sliderLink">Read More</a>
      </div>
  </div>
  </div>
</div>
  </div>
  <div class="divWrapper"><h1>Filterable Categories</h1></div>
    <div class="sliderWrapperEnd"></div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Raleway:400,600);
body{
  background-color:#eeeeee;
/*   display:flex;
  justify-content:center;
  align-items:center;
  height:100vh; */
}
.divWrapper{
  display:flex;
  justify-content:center;
  align-items:center;
  width:100vw;
  min-height: 75vh;
}
.sliderWrapper{
  position:relative;
  width:90vw;
  margin:0 auto;
  display:flex;
} 
.sliderImage{
  position:relative;
  flex-basis:60%;
}

.sliderText{
 flex-basis:40%;
  overflow:hidden;
}
.sliderTextFloat{
  padding:60px;
  position:fixed;
  height:100vh;
  display:flex;
  top:0;
  justify-content:center;
  align-items:center;
  transition:all .5s ease;
  opacity:0;
}
.visible.sliderTextFloat{
  opacity:1;
    transition:all .5s ease;
}

.sliderImageItem {
  transform: translatey(-0%);
  transition: all .4s ease;
  margin-bottom: 40px;
/*     box-shadow:0px 0px 30px 0px #8e8e8e; */
}
.active.sliderImageItem {
  transform: translatey(-0%);
  transition: all .4s ease;
  margin-bottom: 40px;
    box-shadow:0px 0px 30px 0px #8e8e8e;
}
.sliderImage img{
  width:100%;
}
h3.sliderSubText {
  font-family: 'Raleway', sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    color: #c07a4c;
}
.sliderText h2 {
    font-family: 'Raleway', sans-serif;
    margin-bottom: 20px;
     margin-top:0;
    padding-bottom: 10px;
    border-bottom: 2px solid #c07a4c;
    display: inline-block;
}
.sliderText p{
  margin-bottom:20px;
} 

a.sliderLink {
  font-family: 'Raleway', sans-serif;
    padding: 9px 15px;
    background: #c07a4c;
    display: inline-block;
    color: #fff;
    text-transform: uppercase;
    font-size: 13px;
}
#output {
    position : fixed;
    font-size: 10px;
    top      : 0;
    right    : 0;
    height   : 200px;
    width    : 300px;
    border   : 1px solid yellow;
    overflow : hidden;
    display:none;
}
.sliderWrapperEnd{
  position:fixed;
  width:100vw;
  border:1px solid red;
  display:none;
}
            
          
!
            
              $(function() {
  $('.sliderImage').removeClass('load');
});

function eventTextChange(currentItem, stage) {

  if (stage === 'active') {
    if (currentItem.hasClass('active')) {

    } else  {
      currentItem.addClass('active');
      $('.sliderTextFloat').addClass('visible');
      $('.sliderTitleText span').text(currentItem.attr('data-title'));
      $('.sliderTextFloat p').text(currentItem.attr('data-text'));
    }
  } else if (stage === 'above-active'){
    if(currentItem.index() == 0){
       $('.sliderTextFloat').removeClass('visible');
       currentItem.removeClass('active');       
    } else {
      currentItem.removeClass('active'); 
    }
  } else if (stage === 'below-active'){
    if(currentItem.index() == sliderLength){
       $('.sliderTextFloat').removeClass('visible');
       currentItem.removeClass('active');       
    } else {
      currentItem.removeClass('active'); 
    }
  }
}

var $output = $('#output'),
  sliderLength = $('.sliderImageWrapper').children().length - 1,
  currentIndex = $('.sliderImageItem.active').index(),
  windowHalfHeight = $(window).height() / 2;

$('.sliderWrapperEnd').css('top', windowHalfHeight);

$(window).on('scroll', function() {
  $('.sliderImageItem').each(function() {
    var scrollTop = $(window).scrollTop(),
      elementOffsetTop = $(this).offset().top,
      elementHeight = $(this).height(),
      elementOffsetBottom = elementOffsetTop + elementHeight,
      distanceTop = Math.round(elementOffsetTop - (scrollTop + windowHalfHeight)),
      distanceBottom = Math.round(elementOffsetBottom - scrollTop);
    
    $output.prepend('<p>distanceTop :' + distanceTop + ' - height : ' + (distanceTop < -elementHeight) + '</p>');
    if ((distanceTop < 0) && (distanceTop > -elementHeight)) {
      // If the Center of the viewport falls upon a element - Add active class
      eventTextChange($(this), 'active');
    } else if (distanceTop < -elementHeight) {
      //If the Center of the viewport drops below the element - Remove active class
      eventTextChange($(this), 'below-active');
    } else if (distanceTop > 0) {
      //If the Center of the viewport rises above the element - Remove active class
      eventTextChange($(this), 'above-active');
    }
    // $output.prepend('<p>Scroll-Down: ' + $(this).index() + ' : ' + distance + '</p>');
  });

});
            
          
!
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