upgrade readmore.js and improve collapsing a little

This commit is contained in:
Mario Vavti
2016-07-22 14:03:14 +02:00
parent 7d897a3f03
commit 38e46fff54
3 changed files with 40 additions and 16 deletions

View File

@@ -659,7 +659,7 @@ function collapseHeight() {
var position = $(window).scrollTop();
$(".wall-item-content, .directory-collapse").each(function() {
var orgHeight = parseInt($(this).css('height'));
var orgHeight = $(this).outerHeight(true);
if(orgHeight > divmore_height) {
if(! $(this).hasClass('divmore')) {
@@ -679,7 +679,7 @@ function collapseHeight() {
beforeToggle: function(trigger, element, expanded) {
if(expanded) {
if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) {
$(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height));
$(window).scrollTop($(window).scrollTop() - ($(element).outerHeight(true) - divmore_height));
}
}
}