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