Skip to content
Snippets Groups Projects
Commit cebc5f63 authored by permcu's avatar permcu
Browse files

Show top visible as fragment in url

parent a9cf0f46
No related branches found
No related tags found
2 merge requests!355Implement infinite scrolling and by date navigation for coursebook,!350Resolve "Add simple course book list"
...@@ -307,13 +307,8 @@ export default { ...@@ -307,13 +307,8 @@ export default {
// integrate into docsByDay // integrate into docsByDay
} }
}, },
gotoDate(date, scroll) { setDate(date) {
// show
this.$router.replace({ hash: date }) this.$router.replace({ hash: date })
console.log('hash', this.$route.hash);
// assure
this.assureDate(DateTime.fromISO(date));
// scroll
}, },
onIntersect(entries, observer) { onIntersect(entries, observer) {
const entry = entries[0]; const entry = entries[0];
...@@ -325,7 +320,7 @@ export default { ...@@ -325,7 +320,7 @@ export default {
if (this.visible[0] > entry.target.dataset.date || this.visible.length === 0) { if (this.visible[0] > entry.target.dataset.date || this.visible.length === 0) {
// coming is new first (top) date // coming is new first (top) date
this.visible.unshift(entry.target.dataset.date); this.visible.unshift(entry.target.dataset.date);
console.log('current', this.visible[0]); this.setDate(this.visible[0]);
} else if (this.visible[this.visible.length -1] < entry.target.dataset.date) { } else if (this.visible[this.visible.length -1] < entry.target.dataset.date) {
// coming is new last (bottom) date // coming is new last (bottom) date
this.visible.push(entry.target.dataset.date); this.visible.push(entry.target.dataset.date);
...@@ -340,7 +335,7 @@ export default { ...@@ -340,7 +335,7 @@ export default {
} else if (this.visible[0] === entry.target.dataset.date) { } else if (this.visible[0] === entry.target.dataset.date) {
// first (top) visible date is going // first (top) visible date is going
this.visible.shift() this.visible.shift()
console.log('current', this.visible[0]); this.setDate(this.visible[0]);
} else if (this.visible[this.visible.length - 1] === entry.target.dataset.date) { } else if (this.visible[this.visible.length - 1] === entry.target.dataset.date) {
// last (bottom) visible date is going // last (bottom) visible date is going
this.visible.pop() this.visible.pop()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment