since we preload images now we also can collapse and calculate posts above the viewport
This commit is contained in:
parent
c5827c8b4f
commit
3be6ef6bfc
@ -638,12 +638,24 @@ function updateConvItems(mode,data) {
|
||||
|
||||
function collapseHeight() {
|
||||
var origContentHeight = parseInt($("#region_2").height());
|
||||
var cDiff = 0;
|
||||
var i = 0;
|
||||
var position = $(window).scrollTop();
|
||||
|
||||
$(".wall-item-content, .directory-collapse").each(function() {
|
||||
var orgHeight = parseInt($(this).css('height'));
|
||||
if(orgHeight > divmore_height) {
|
||||
if(! $(this).hasClass('divmore')) {
|
||||
|
||||
var trigger = $(window).scrollTop() < $(this).offset().top ? true : false;
|
||||
//var trigger = $(window).scrollTop() < $(this).offset().top ? true : false;
|
||||
var trigger = true;
|
||||
|
||||
// check if we will collapse some content above the visible content and compensate the diff later
|
||||
if($(window).scrollTop() > $(this).offset().top) {
|
||||
diff = orgHeight - divmore_height;
|
||||
cDiff = cDiff + diff;
|
||||
i++;
|
||||
}
|
||||
|
||||
if(trigger) {
|
||||
$(this).readmore({
|
||||
@ -670,6 +682,12 @@ function collapseHeight() {
|
||||
contentHeightDiff = origContentHeight - collapsedContentHeight;
|
||||
console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px');
|
||||
|
||||
if(i){
|
||||
var sval = position - cDiff + $(".divgrow-showmore").height();
|
||||
console.log('collapsed above content count: ' + i);
|
||||
$(window).scrollTop(sval);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user