small fix to simple cover-photo

This commit is contained in:
Mario Vavti 2016-03-02 14:30:33 +01:00
parent c5d08fd5fd
commit d3f2d2a2db
2 changed files with 4 additions and 6 deletions

View File

@ -12,18 +12,17 @@ main {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
padding-top: 71px;
} }
aside { aside {
display: table-cell; display: table-cell;
vertical-align: top; vertical-align: top;
padding: 0px 7px 0px 7px; padding: 71px 7px 0px 7px;
} }
section { section {
width: 100%; width: 100%;
display: table-cell; display: table-cell;
vertical-align: top; vertical-align: top;
padding: 0px 7px 200px 7px; padding: 71px 7px 200px 7px;
} }

View File

@ -6,12 +6,11 @@ $(document).ready(function() {
//Simple cover-photo implementation //Simple cover-photo implementation
if($('#cover-photo').length && $(window).width() > 767) { if($('#cover-photo').length && $(window).width() > 767) {
$('.navbar-fixed-top').css('position', 'relative'); $('.navbar-fixed-top').css('position', 'relative');
$('main').css('padding-top', 0 + 'px'); $('aside, section').css('padding-top', 0 + 'px');
$('main').css('opacity', 0); $('main').css('opacity', 0);
} }
else { else {
$('#cover-photo').remove(); $('#cover-photo').remove();
} }
// CSS3 calc() fallback (for unsupported browsers) // CSS3 calc() fallback (for unsupported browsers)
@ -67,7 +66,7 @@ $(document).ready(function() {
//Simple cover-photo implementation //Simple cover-photo implementation
$(window).scroll(function () { $(window).scroll(function () {
if($('#cover-photo').length && $(window).width() > 767 && $(window).scrollTop() >= $('#cover-photo').height()) { if($('#cover-photo').length && $(window).width() > 767 && $(window).scrollTop() >= $('#cover-photo').height()) {
$('main').css('padding-top', 71 + 'px'); $('aside, section').css('padding-top', 71 + 'px');
$(window).scrollTop($(window).scrollTop() - $('#cover-photo').height()) $(window).scrollTop($(window).scrollTop() - $('#cover-photo').height())
$('.navbar-fixed-top').css('position', 'fixed'); $('.navbar-fixed-top').css('position', 'fixed');
$('#cover-photo').remove(); $('#cover-photo').remove();