avoid collapsing only above the viewport

This commit is contained in:
Mario Vavti
2016-02-08 22:19:38 +01:00
parent 00ae6bdac6
commit 48963f62f9
2 changed files with 2 additions and 3 deletions

View File

@@ -641,7 +641,7 @@ function collapseHeight() {
if(orgHeight > divmore_height) {
if(! $(this).hasClass('divmore')) {
var trigger = $(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top ? true : false;
var trigger = $(window).scrollTop() < $(this).offset().top ? true : false;
if(trigger) {
$(this).readmore({
@@ -653,7 +653,7 @@ function collapseHeight() {
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: 0 } );
$(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height));
}
}
}