diff options
Diffstat (limited to 'view')
-rw-r--r-- | view/js/main.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/view/js/main.js b/view/js/main.js index f6bc22e34..07035aee3 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -616,12 +616,20 @@ function updateConvItems(mode,data) { function collapseHeight() { $(".wall-item-body, .contact-info").each(function() { - if($(this).height() > divmore_height + 10) { + var orgHeight = $(this).height(); + if(orgHeight > divmore_height + 10) { if(! $(this).hasClass('divmore')) { $(this).readmore({ collapsedHeight: divmore_height, moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>', - lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>' + lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>', + beforeToggle: function(trigger, element, expanded) { + if(expanded) { + if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) { + $('html, body').animate( { scrollTop: $(window).scrollTop() - (orgHeight - divmore_height) }, {duration: 100 } ); + } + } + } }); $(this).addClass('divmore'); } |