Fix scrolling to assignments

This commit is contained in:
Ramon Wenger 2019-12-18 13:18:17 +01:00
parent cb13aa1ea5
commit b132e320af
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="assignment">
<div class="assignment" :data-scrollto="assignment.id">
<p class="assignment__assignment-text">
{{assignment.assignment}}
</p>

View File

@ -46,7 +46,7 @@
if (mutation.type === 'setScrollToAssignmentReady' && mutation.payload && !this.isScrollingToAssignment) {
this.scrollingToAssignment(true);
let options = {
container: '#app',
container: 'body',
easing: 'ease',
offset: -60,
onStart: (element) => {
@ -62,7 +62,7 @@
y: true
};
setTimeout(() => {
this.$scrollTo(`#${this.scrollToAssignmentId.replace(/=/g, '')}`, 1000, options);
this.$scrollTo(`[data-scrollto="${this.scrollToAssignmentId}"]`, 1000, options);
}, 250) // unfortunately this timeout is needed as it is hard to tell when everything is rendered
}
})