Hide footer campain bar similar to gap.com
HTML
<link rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.min.css">
<div class="test"></div>
<div class="panel-group sticky-footer" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Collapsible Group Item #1
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
SCSS
body {
position: relative;
}
.test {
height: 1500px;
margin: 500px 0;
background-color: #eee;
}
.sticky-footer {
width: 100%;
text-align: center;
position: fixed;
bottom: 0;
margin-bottom: 0;
border-radius: 0;
}
JavaScript
$(document).ready(function(){
//Check to see if the window is at the top of the screen, and display campaign bar.
$(window).scroll(function(){
if ($(this).scrollTop() < (screen.height*0.75)) {
$('.sticky-footer').fadeIn();
} else {
$('.sticky-footer').fadeOut();
}
});
$('#collapseOne').on('show.bs.collapse', function() {
$('h4').hide();
});
$('#collapseOne').on('hidden.bs.collapse', function() {
$('h4').show();
});
$('#collapseOne').click(function() {
$('#collapseOne').collapse('hide');
})
});