move
This commit is contained in:
28
src/mixins/BaseCollection.vue
Normal file
28
src/mixins/BaseCollection.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
item: { covers: {} },
|
||||
},
|
||||
methods: {
|
||||
scrollFunction() {
|
||||
let element = document.getElementById(this.item._id);
|
||||
let bounding = element.getBoundingClientRect();
|
||||
let scrollDown = bounding.top < 56;
|
||||
let scrollUp =
|
||||
bounding.top + bounding.height >
|
||||
(window.innerHeight || document.documentElement.clientHeight);
|
||||
if (scrollDown) {
|
||||
element.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "start",
|
||||
});
|
||||
} else if (scrollUp) {
|
||||
element.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "end",
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user