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

Introduce top-margin prop - document the magic number

parent 6ea5c885
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"
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
v-intersect="{ v-intersect="{
handler: intersectHandler(date, first, last), handler: intersectHandler(date, first, last),
options: { options: {
rootMargin: '-165px 0px 0px 0px', rootMargin: '-' + topMargin + 'px 0px 0px 0px',
threshold: [0, 1], threshold: [0, 1],
}, },
}" }"
...@@ -102,6 +102,14 @@ export default { ...@@ -102,6 +102,14 @@ export default {
required: false, required: false,
default: null, default: null,
}, },
/**
* Margin from coursebook list to top of viewport in pixels
*/
topMargin: {
type: Number,
required: false,
default: 165,
},
}, },
data() { data() {
return { return {
...@@ -258,8 +266,7 @@ export default { ...@@ -258,8 +266,7 @@ export default {
const entry = entries[0]; const entry = entries[0];
if (entry.isIntersecting) { if (entry.isIntersecting) {
// TODO: Make 165 a var? if ((entry.boundingClientRect.top <= this.topMargin) || first) {
if ((entry.boundingClientRect.top <= 165) || first) {
console.log('@', date.toISODate()); console.log('@', date.toISODate());
this.setDate(date.toISODate()); this.setDate(date.toISODate());
} }
......
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