FIX: Safer offset checking
This commit is contained in:
parent
3ac4a40208
commit
eccfa1317a
|
@ -24,7 +24,9 @@ export default MountWidget.extend(Docking, {
|
||||||
},
|
},
|
||||||
|
|
||||||
dockCheck(info) {
|
dockCheck(info) {
|
||||||
const topicTop = $('.container.posts').offset().top - $('#main').offset().top;
|
const mainOffset = $('#main').offset();
|
||||||
|
const offsetTop = mainOffset ? mainOffset.top : 0;
|
||||||
|
const topicTop = $('.container.posts').offset().top - offsetTop;
|
||||||
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() || 400;
|
const timelineHeight = $timeline.height() || 400;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
const helper = {
|
const helper = {
|
||||||
offset: () => (window.pageYOffset || $('html').scrollTop()) - $('#main').offset().top
|
offset() {
|
||||||
|
const mainOffset = $('#main').offset();
|
||||||
|
const offsetTop = mainOffset ? mainOffset.top : 0;
|
||||||
|
return (window.pageYOffset || $('html').scrollTop()) - offsetTop;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Ember.Mixin.create({
|
export default Ember.Mixin.create({
|
||||||
|
|
Loading…
Reference in New Issue