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 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.

Quick-add: + add another resource

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.

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 class="section persist-area">

	<div class="section-header-wrapper">
		<div class="section-header">Section Header 1</div>
	</div>
	<div class="section-content">
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eu nisi at tellus efficitur lobortis a suscipit elit. Nulla sem arcu, imperdiet id lorem ut, cursus commodo urna. Duis malesuada pulvinar est, non venenatis nisi euismod nec. Integer euismod commodo ipsum, ac malesuada tellus vehicula eu. Aliquam eget erat interdum, accumsan lorem ac, mollis metus. Ut molestie velit a leo rhoncus, maximus lacinia nisi faucibus. Cras aliquet nec odio ac semper. Integer nec facilisis quam. Curabitur mattis tortor sed leo eleifend, eu laoreet ex cursus. Morbi accumsan congue nisi vitae euismod. Cras id ipsum turpis. Aliquam lacinia, dolor sed pretium tristique, leo massa dapibus lorem, at molestie augue sapien non diam. 
	</div>

</div>

<div class="section persist-area">

	<div class="section-header-wrapper">
		<div class="section-header">Section Header 2</div>
	</div>
	<div class="section-content">
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eu nisi at tellus efficitur lobortis a suscipit elit. Nulla sem arcu, imperdiet id lorem ut, cursus commodo urna. Duis malesuada pulvinar est, non venenatis nisi euismod nec. Integer euismod commodo ipsum, ac malesuada tellus vehicula eu. Aliquam eget erat interdum, accumsan lorem ac, mollis metus. Ut molestie velit a leo rhoncus, maximus lacinia nisi faucibus. Cras aliquet nec odio ac semper. Integer nec facilisis quam. Curabitur mattis tortor sed leo eleifend, eu laoreet ex cursus. Morbi accumsan congue nisi vitae euismod. Cras id ipsum turpis. Aliquam lacinia, dolor sed pretium tristique, leo massa dapibus lorem, at molestie augue sapien non diam. 
	</div>

</div>

<div class="section persist-area">

	<div class="section-header-wrapper">
		<div class="section-header">Section Header 3</div>
	</div>
	<div class="section-content">
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eu nisi at tellus efficitur lobortis a suscipit elit. Nulla sem arcu, imperdiet id lorem ut, cursus commodo urna. Duis malesuada pulvinar est, non venenatis nisi euismod nec. Integer euismod commodo ipsum, ac malesuada tellus vehicula eu. Aliquam eget erat interdum, accumsan lorem ac, mollis metus. Ut molestie velit a leo rhoncus, maximus lacinia nisi faucibus. Cras aliquet nec odio ac semper. Integer nec facilisis quam. Curabitur mattis tortor sed leo eleifend, eu laoreet ex cursus. Morbi accumsan congue nisi vitae euismod. Cras id ipsum turpis. Aliquam lacinia, dolor sed pretium tristique, leo massa dapibus lorem, at molestie augue sapien non diam. 
	</div>

</div>

<div class="section persist-area">

	<div class="section-header-wrapper">
		<div class="section-header">Section Header 4</div>
	</div>
	<div class="section-content">
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eu nisi at tellus efficitur lobortis a suscipit elit. Nulla sem arcu, imperdiet id lorem ut, cursus commodo urna. Duis malesuada pulvinar est, non venenatis nisi euismod nec. Integer euismod commodo ipsum, ac malesuada tellus vehicula eu. Aliquam eget erat interdum, accumsan lorem ac, mollis metus. Ut molestie velit a leo rhoncus, maximus lacinia nisi faucibus. Cras aliquet nec odio ac semper. Integer nec facilisis quam. Curabitur mattis tortor sed leo eleifend, eu laoreet ex cursus. Morbi accumsan congue nisi vitae euismod. Cras id ipsum turpis. Aliquam lacinia, dolor sed pretium tristique, leo massa dapibus lorem, at molestie augue sapien non diam. 
	</div>

</div>

<div class="section persist-area">

	<div class="section-header-wrapper">
		<div class="section-header">Section Header 5</div>
	</div>
	<div class="section-content">
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eu nisi at tellus efficitur lobortis a suscipit elit. Nulla sem arcu, imperdiet id lorem ut, cursus commodo urna. Duis malesuada pulvinar est, non venenatis nisi euismod nec. Integer euismod commodo ipsum, ac malesuada tellus vehicula eu. Aliquam eget erat interdum, accumsan lorem ac, mollis metus. Ut molestie velit a leo rhoncus, maximus lacinia nisi faucibus. Cras aliquet nec odio ac semper. Integer nec facilisis quam. Curabitur mattis tortor sed leo eleifend, eu laoreet ex cursus. Morbi accumsan congue nisi vitae euismod. Cras id ipsum turpis. Aliquam lacinia, dolor sed pretium tristique, leo massa dapibus lorem, at molestie augue sapien non diam. 
	</div>

</div>
            
          
!
            
              .section
{
	margin: auto;
	padding: 20px;
	width: 500px;
	position: relative;
	font-size: 20px;
}

.section-header-wrapper
{
	height:20px;
}

.section-header
{
	transition: all 0.4s ease;
}

.sticky
{
	font-size: 30px;
	background-color: rgba(200, 200, 200, 0.5);
	height: 40px;
}

.sticky-active
{
	position: fixed;
	top: 0;
}

.sticky-parked
{
	position: absolute;
	bottom: 20px;
}
            
          
!
            
              $(document).ready( function() {

	var bottomMBP = parseInt($($(".persist-area")[0]).css("margin-bottom"), 10) + parseInt($($(".persist-area")[0]).css("borderBottomWidth"), 10) + parseInt($($(".persist-area")[0]).css("padding-bottom"), 10);

	function updateTableHeaders() {
	   $(".persist-area").each(function() {
	   
	       var el             = $(this),
	           offset         = el.offset(),
	           scrollTop      = $(window).scrollTop(),
	           sectionHeader = $(".section-header", this),
             sectionHeaderWrapper = $(".section-header-wrapper", this),
             sectionHeaderWrapperOffset = sectionHeaderWrapper.offset();
	       
	       if ((scrollTop > sectionHeaderWrapperOffset.top))
	       {
	       		sectionHeader.addClass("sticky");

	       		if ((scrollTop < offset.top + el.outerHeight() - bottomMBP - sectionHeader.height()))
	       		{
	       			sectionHeader.removeClass("sticky-parked");
	       			sectionHeader.addClass("sticky-active");
	       		} else
	       		{
	       			sectionHeader.removeClass("sticky-active");
	       			sectionHeader.addClass("sticky-parked");
	       		}
	       } else
	       {
	       		sectionHeader.removeClass("sticky-active");
	       		sectionHeader.removeClass("sticky");
	       }

	   });
	}

	updateTableHeaders();
	$(window).scroll(updateTableHeaders);
});
            
          
!
999px
Loading ..................

Console