do not move viewed content off the screen after collapsing a long post
This commit is contained in:
parent
a5f410d587
commit
c521a28486
@ -616,12 +616,20 @@ function updateConvItems(mode,data) {
|
|||||||
|
|
||||||
function collapseHeight() {
|
function collapseHeight() {
|
||||||
$(".wall-item-body, .contact-info").each(function() {
|
$(".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')) {
|
if(! $(this).hasClass('divmore')) {
|
||||||
$(this).readmore({
|
$(this).readmore({
|
||||||
collapsedHeight: divmore_height,
|
collapsedHeight: divmore_height,
|
||||||
moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>',
|
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');
|
$(this).addClass('divmore');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user