Commit 8c5e4b95 authored by JC Brand's avatar JC Brand

Updates #1939: Enable smooth scrolling for short distances

parent 5fd31681
...@@ -100,6 +100,10 @@ body.converse-fullscreen { ...@@ -100,6 +100,10 @@ body.converse-fullscreen {
background-color: #EEE !important; background-color: #EEE !important;
} }
.smooth-scroll {
scroll-behavior: smooth !important;
}
.nopadding { .nopadding {
padding: 0 !important; padding: 0 !important;
} }
......
...@@ -1360,6 +1360,11 @@ converse.plugins.add('converse-chatview', { ...@@ -1360,6 +1360,11 @@ converse.plugins.add('converse-chatview', {
return; return;
} }
if (u.isVisible(this.content) && !this.model.get('scrolled')) { if (u.isVisible(this.content) && !this.model.get('scrolled')) {
if ((this.content.scrollTop === 0 || this.content.scrollTop < this.content.scrollHeight/2)) {
u.removeClass('smooth-scroll', this.content);
} else if (api.settings.get('animate')) {
u.addClass('smooth-scroll', this.content);
}
this.content.scrollTop = this.content.scrollHeight; this.content.scrollTop = this.content.scrollHeight;
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment