mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Timeline has to dock at the top too for long titles + banners
This commit is contained in:
parent
1584033d7a
commit
1e3e4a95fd
3 changed files with 10 additions and 5 deletions
|
@ -15,6 +15,7 @@ export default MountWidget.extend(Docking, {
|
|||
dockCheck(info) {
|
||||
if (this.get('loading')) { return; }
|
||||
|
||||
const topicTop = $('.container.posts').offset().top;
|
||||
const topicBottom = $('#topic-bottom').offset().top;
|
||||
const $timeline = this.$('.timeline-container');
|
||||
const timelineHeight = $timeline.height();
|
||||
|
@ -23,8 +24,12 @@ export default MountWidget.extend(Docking, {
|
|||
const tTop = 140;
|
||||
|
||||
const prev = this.dockAt;
|
||||
const pos = tTop + info.offset() + timelineHeight;
|
||||
if (pos > topicBottom) {
|
||||
const posTop = tTop + info.offset();
|
||||
const pos = posTop + timelineHeight;
|
||||
|
||||
if (posTop < topicTop) {
|
||||
this.dockAt = 0;
|
||||
} else if (pos > topicBottom) {
|
||||
this.dockAt = topicBottom - timelineHeight - parentTop;
|
||||
} else {
|
||||
this.dockAt = null;
|
||||
|
|
|
@ -14,7 +14,7 @@ export default Ember.Mixin.create({
|
|||
$(window).bind('scroll.discourse-dock', this._dockHandler);
|
||||
$(document).bind('touchmove.discourse-dock', this._dockHandler);
|
||||
|
||||
this._dockHandler();
|
||||
this.dockCheck(helper);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
|
|
|
@ -187,11 +187,11 @@ createWidget('timeline-scrollarea', {
|
|||
createWidget('topic-timeline-container', {
|
||||
tagName: 'div.timeline-container',
|
||||
buildClasses(attrs) {
|
||||
if (attrs.dockAt) { return 'timeline-docked'; }
|
||||
if (attrs.dockAt !== null) { return 'timeline-docked'; }
|
||||
},
|
||||
|
||||
buildAttributes(attrs) {
|
||||
if (attrs.dockAt) {
|
||||
if (attrs.dockAt !== null) {
|
||||
return { style: `top: ${attrs.dockAt}px` };
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue