cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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.

            
              <figure class="banner">
  <div class="banner-wrapper" style="background-image:url(https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLQUJ6X0NTU19QTkE);">
    <img src="https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLQUJ6X0NTU19QTkE" class="banner-img" />
  </div>
  <figcaption>
    <h2>Scrolling Blur</h2>
    <p>Lorem ipsum dolor sit amet consectetuer adipiscing elit</p>
  </figcaption>
</figure>
<section class="content">
  <p>Under Content...</p>
</section>

<figure class="banner">
  <div class="banner-wrapper" style="background-image:url(https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLanNPc3pYMzVlTjQ);">
    <img src="https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLanNPc3pYMzVlTjQ" class="banner-img" />
  </div>
  <figcaption>
    <h2>Second blurring...</h2>
    <p>Lorem ipsum dolor sit amet consectetuer adipiscing elit</p>
  </figcaption>
</figure>
<section class="content two">
  <p>Under Content...</p>
</section>

<figure class="banner">
  <div class="banner-wrapper" style="background-image:url(https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLR1YybUp2R0t0MjQ);">
    <img src="https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLR1YybUp2R0t0MjQ" class="banner-img" />
  </div>
  <figcaption>
    <h2>Third blurring...</h2>
    <p>Lorem ipsum dolor sit amet consectetuer adipiscing elit</p>
  </figcaption>
</figure>
<section class="content">
  <p>Under Content...</p>
</section>

            
          
!
            
              // ******************************
// Normalize (ignore me!)
// ******************************
@import "compass";
@import "compass/css3";
@import url(//fonts.googleapis.com/css?family=Lato:300);
$fonts:Lato,Arial,"Hiragino Kaku Gothic Pro W3",Meiryo,sans-serif;
$bg_color:#fff;
$font_color:#666;
$link_color:#666;
$link_hover_color:#888;

*, *:before, *:after{
  box-sizing:border-box;
  padding:0;
  margin:0;
}
body{
  font-family:$fonts;
  background-color:$bg_color;
  color: $font_color;
  text-align: center;
  a, a:visited{
    color: $link_color;
    text-decoration:none;
  }
  a:hover{
    color: $link_hover_color;
  }
}
// ******************************
// End of Normalize
// ******************************

figure {
  position:relative;
  // height:40vw;
  overflow:hidden;
  z-index:0;
  
  .banner-wrapper{
    background-position:center;
    background-size:100% auto;
    margin:-10px;
  }
  .banner-img {
    vertical-align:bottom;
    opacity:0;
    -webkit-backface-visibility:hidden;
    width:calc(100% + 20px);
    margin:-10px;
    @include filter(blur(10px));
  }
  
  figcaption {
    position:absolute;
    top:22vw;
    width:100%;
    color:#fff;

    h2 {
      font-size:45px;
      margin-bottom:30px;
      text-shadow:0 2px 12px rgba(#000,0.52);
    }
    p{
      text-shadow:0 0 6px rgba(#000,0.6);
    }
  }
}

.content {
  padding:140px 20px;
  &.two{
    background-color:#333;
    color:#aaa;
  }
  p{
    font-size:72px;
  }
}
            
          
!
            
              var scrollBlur = {
  bannerSelector: '.banner',
  imgSelector: '.banner-img',
  degree: 2
}
var banner = null;

// When DOM loaded
$(function(){
  banner = $(scrollBlur.bannerSelector);
});

// Scroll event
$(window).on('scroll', function(){
  if (!banner[0]) return;
  
	var scrollTop = $(window).scrollTop();
  
  banner.each( function(){
    var offsetTop = $(this).offset().top;
    
    $(this).find(scrollBlur.imgSelector).each(function(){
      var current = $(this);
      if ( scrollTop > offsetTop && scrollTop < offsetTop + current.height() ) {
        var opacity = Math.floor( (scrollTop - offsetTop) * scrollBlur.degree / current.height() * Math.pow( 10, 2 ) ) / Math.pow( 10, 2 );

        if ( opacity <= 1 ) {
          current.css('opacity', opacity);
        }
      }
    });
  });
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console