diff options
Diffstat (limited to 'view/tpl/cover_photo_widget.tpl')
-rwxr-xr-x | view/tpl/cover_photo_widget.tpl | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/view/tpl/cover_photo_widget.tpl b/view/tpl/cover_photo_widget.tpl index 4e210a300..2b47270c9 100755 --- a/view/tpl/cover_photo_widget.tpl +++ b/view/tpl/cover_photo_widget.tpl @@ -1,22 +1,28 @@ <script> var aside_padding_top; var section_padding_top; + var coverSlid = false; $(document).ready(function() { aside_padding_top = parseInt($('aside').css('padding-top')); section_padding_top = parseInt($('section').css('padding-top')); + $(document).on('click', slideUpCover); + if($('#cover-photo').length && $(window).width() > 755) { - $('.navbar-fixed-top').css('position', 'relative'); - $('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(); + if($(window).scrollTop() < $('#cover-photo').height()) { + $('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'); + $('.navbar-fixed-top').css('position', 'relative'); + $('main').css('opacity', 0); + $('header').hide(); + } } else { $('#cover-photo').remove(); + coverSlid = true; } }); @@ -26,10 +32,26 @@ $('main').css('opacity', 1); $('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'); + $('.navbar-fixed-top').css('position', ''); $('main').css('margin-top', ''); - $('#cover-photo').remove(); + coverSlid = true; + } + else if ($('#cover-photo').length && $(window).width() > 755 && $(window).scrollTop() < $('#cover-photo').height()){ + if(coverSlid) { + $(window).scrollTop(Math.ceil($('#cover-photo').height())); + setTimeout(function(){ coverSlid = false; }, 1000); + } + else { + if($(window).scrollTop() < $('#cover-photo').height()) { + $('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'); + + $('.navbar-fixed-top').css('position', 'relative'); + $('main').css('opacity', 0); + $('header').hide(); + } + } } if($('#cover-photo').length) { $('main').css('opacity', ($(window).scrollTop()/$('#cover-photo').height()).toFixed(1)); @@ -38,21 +60,26 @@ $(window).resize(function () { if($('#cover-photo').length && $(window).width() < 755) { + $('#cover-photo').remove(); $('main').css('opacity', 1); $('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(); + $('.navbar-fixed-top').css('position', ''); + coverSlid = true; } }); function slideUpCover() { + if(coverSlid) { + return; + } $('html, body').animate({scrollTop: Math.ceil($('#cover-photo').height()) + 'px' }); + return; } </script> -<div id="cover-photo" onclick="slideUpCover();" title="{{$hovertitle}}"> +<div id="cover-photo" title="{{$hovertitle}}"> {{$photo_html}} <div id="cover-photo-caption"> <div class="cover-photo-title"> |