mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: Safer offset checking
This commit is contained in:
parent
3ac4a40208
commit
eccfa1317a
2 changed files with 8 additions and 2 deletions
|
@ -24,7 +24,9 @@ export default MountWidget.extend(Docking, {
|
|||
},
|
||||
|
||||
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 $timeline = this.$('.timeline-container');
|
||||
const timelineHeight = $timeline.height() || 400;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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({
|
||||
|
|
Loading…
Reference in a new issue