From bc5a679bb60f2637e975b250e4c863c871232bbf Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sun, 12 Apr 2020 15:26:37 -0400 Subject: [PATCH] [+] Calculate height for cards --- .../course-selection/course-selection.vue | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pages/course-selection/course-selection.vue b/src/pages/course-selection/course-selection.vue index 1400cb9..0361bb5 100644 --- a/src/pages/course-selection/course-selection.vue +++ b/src/pages/course-selection/course-selection.vue @@ -14,14 +14,14 @@ - + - +
Course List
@@ -59,6 +59,7 @@ loading = true courseListHeight: number = 0; + cardsHeight: number = 0; /** * Called before rendering @@ -103,13 +104,18 @@ } /** - * Update header width. (CSS doesn't work) - * https://stackoverflow.com/questions/17011195/positionfixed-and-widthinherit-with-percentage-parent + * Update header height. (CSS doesn't work) */ updateHeight() { - if (( this.$refs.cl) == null) return; - this.courseListHeight = ( this.$refs.cl).$el.clientHeight - 15 - 102; + // Get element + let cl = this.$refs.cl as Vue; + if (cl as any == null) return; + let el = cl.$el; + + // Calculate height + this.cardsHeight = window.innerHeight - el.getBoundingClientRect().top - 20; + this.courseListHeight = this.cardsHeight - 15 - 102; }