FIX: Timeline has to dock at the top too for long titles + banners
This commit is contained in:
parent
1584033d7a
commit
1e3e4a95fd
|
@ -15,6 +15,7 @@ export default MountWidget.extend(Docking, {
|
||||||
dockCheck(info) {
|
dockCheck(info) {
|
||||||
if (this.get('loading')) { return; }
|
if (this.get('loading')) { return; }
|
||||||
|
|
||||||
|
const topicTop = $('.container.posts').offset().top;
|
||||||
const topicBottom = $('#topic-bottom').offset().top;
|
const topicBottom = $('#topic-bottom').offset().top;
|
||||||
const $timeline = this.$('.timeline-container');
|
const $timeline = this.$('.timeline-container');
|
||||||
const timelineHeight = $timeline.height();
|
const timelineHeight = $timeline.height();
|
||||||
|
@ -23,8 +24,12 @@ export default MountWidget.extend(Docking, {
|
||||||
const tTop = 140;
|
const tTop = 140;
|
||||||
|
|
||||||
const prev = this.dockAt;
|
const prev = this.dockAt;
|
||||||
const pos = tTop + info.offset() + timelineHeight;
|
const posTop = tTop + info.offset();
|
||||||
if (pos > topicBottom) {
|
const pos = posTop + timelineHeight;
|
||||||
|
|
||||||
|
if (posTop < topicTop) {
|
||||||
|
this.dockAt = 0;
|
||||||
|
} else if (pos > topicBottom) {
|
||||||
this.dockAt = topicBottom - timelineHeight - parentTop;
|
this.dockAt = topicBottom - timelineHeight - parentTop;
|
||||||
} else {
|
} else {
|
||||||
this.dockAt = null;
|
this.dockAt = null;
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default Ember.Mixin.create({
|
||||||
$(window).bind('scroll.discourse-dock', this._dockHandler);
|
$(window).bind('scroll.discourse-dock', this._dockHandler);
|
||||||
$(document).bind('touchmove.discourse-dock', this._dockHandler);
|
$(document).bind('touchmove.discourse-dock', this._dockHandler);
|
||||||
|
|
||||||
this._dockHandler();
|
this.dockCheck(helper);
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
|
|
@ -187,11 +187,11 @@ createWidget('timeline-scrollarea', {
|
||||||
createWidget('topic-timeline-container', {
|
createWidget('topic-timeline-container', {
|
||||||
tagName: 'div.timeline-container',
|
tagName: 'div.timeline-container',
|
||||||
buildClasses(attrs) {
|
buildClasses(attrs) {
|
||||||
if (attrs.dockAt) { return 'timeline-docked'; }
|
if (attrs.dockAt !== null) { return 'timeline-docked'; }
|
||||||
},
|
},
|
||||||
|
|
||||||
buildAttributes(attrs) {
|
buildAttributes(attrs) {
|
||||||
if (attrs.dockAt) {
|
if (attrs.dockAt !== null) {
|
||||||
return { style: `top: ${attrs.dockAt}px` };
|
return { style: `top: ${attrs.dockAt}px` };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue