Przeglądaj źródła

:recycle: raising observer to footer-wrapper | trying a margin

tags/0.9.0
J 4 lat temu
rodzic
commit
56ae15d86a
1 zmienionych plików z 10 dodań i 9 usunięć
  1. 10
    9
      vue-theme/src/pages/list.vue

+ 10
- 9
vue-theme/src/pages/list.vue Wyświetl plik

@@ -74,8 +74,8 @@ export default {
74 74
     },
75 75
     methods: {
76 76
         loadMorePosts() {
77
+            // console.log('loading...')
77 78
             this.page++
78
-            console.log('loading...')
79 79
             this.getPosts(false)
80 80
         },
81 81
         getPosts(clear) {
@@ -194,19 +194,20 @@ export default {
194 194
         if (this.$route.hash) {
195 195
             setTimeout(() => this.scrollTo(this.$route.hash), TIMEOUT)
196 196
         }
197
-    },
198
-    unmounted() {
199
-        window.removeEventListener("load", e => {}, false)
200
-    },
201
-    created() {
197
+
198
+        // Add the infinite scroll load
202 199
         window.addEventListener("load", e => {
203
-            const footerEl = document.querySelector(".sub-footer")
200
+            const footerEl = document.querySelector(".footer-wrapper footer")
204 201
             const observer = new IntersectionObserver(this.loadMorePosts, {
205
-                rootMargin: "0px",
202
+                rootMargin: "0px 0px 50px 0px",
206 203
             })
207 204
             observer.observe(footerEl)
208 205
         }, false)
209
-
206
+    },
207
+    unmounted() {
208
+        window.removeEventListener("load", e => {}, false)
209
+    },
210
+    created() {
210 211
         let type = convertTitleCase(this.type) + 's'
211 212
         this.checkAndSetHero(this.type)
212 213
 

Ładowanie…
Anuluj
Zapisz