diff options
Diffstat (limited to 'view/tpl/cover_photo_widget.tpl')
-rwxr-xr-x | view/tpl/cover_photo_widget.tpl | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/view/tpl/cover_photo_widget.tpl b/view/tpl/cover_photo_widget.tpl index 8254fc87d..5e97d3773 100755 --- a/view/tpl/cover_photo_widget.tpl +++ b/view/tpl/cover_photo_widget.tpl @@ -1,8 +1,17 @@ <script> + var aside_padding_top; + var section_padding_top; + $(document).ready(function() { + + aside_padding_top = parseInt($('aside').css('padding-top')); + section_padding_top = parseInt($('section').css('padding-top')); + if($('#cover-photo').length && $(window).width() > 755) { $('.navbar-fixed-top').css('position', 'relative'); - $('aside, section').css('padding-top', 0 + 'px'); + $('main').css('margin-top', - $('nav').outerHeight(true) + 'px'); + $('aside').css('padding-top', aside_padding_top - $('nav').outerHeight() + 'px'); + $('section').css('padding-top', section_padding_top - $('nav').outerHeight() + 'px'); $('main').css('opacity', 0); $('header').hide(); } @@ -15,9 +24,11 @@ if($('#cover-photo').length && $(window).width() > 755 && $(window).scrollTop() >= $('#cover-photo').height()) { $('header').fadeIn(); $('main').css('opacity', 1); - $('aside, section').css('padding-top', $('nav').outerHeight(true) + 'px'); + $('aside').css('padding-top', aside_padding_top + 'px'); + $('section').css('padding-top', section_padding_top + 'px'); $(window).scrollTop($(window).scrollTop() - $('#cover-photo').height()) $('.navbar-fixed-top').css('position', 'fixed'); + $('main').css('margin-top', ''); $('#cover-photo').remove(); } if($('#cover-photo').length) { @@ -28,7 +39,8 @@ $(window).resize(function () { if($('#cover-photo').length && $(window).width() < 755) { $('main').css('opacity', 1); - $('aside, section').css('padding-top', $('nav').outerHeight(true) + 'px'); + $('aside').css('padding-top', aside_padding_top + 'px'); + $('section').css('padding-top', section_padding_top + 'px'); $('.navbar-fixed-top').css('position', 'fixed'); $('#cover-photo').remove(); } @@ -36,7 +48,7 @@ }); function slideUpCover() { - $('html, body').animate({scrollTop: $('#cover-photo').height() + 'px'}); + $('html, body').animate({scrollTop: $('#cover-photo').height() + 1 + 'px' }); } </script> |