From f8a8e491a86cbdf7a48fb09522d8d0f6f9d61b96 Mon Sep 17 00:00:00 2001 From: shivan2418 Date: Sun, 27 Oct 2019 20:13:25 -0400 Subject: [PATCH] Moved some functionality into its own func --- js/script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/script.js b/js/script.js index 6446fb5..f1314ed 100644 --- a/js/script.js +++ b/js/script.js @@ -4,8 +4,6 @@ // select all the students by getting all the children of the student list div const student_list = document.querySelector('.student-list').children; const items_per_page = 10; -// calculate how many nav buttons are needed, use the rounded up number. -const num_navbuttons = Math.ceil(student_list.length / items_per_page); // Create theh pagination buttons appendPageLinks(); @@ -53,7 +51,9 @@ function updateButtons(event) { function appendPageLinks() { console.log('page func'); - let navbuttons = []; + // calculate how many nav buttons are needed, use the rounded up number. + const num_navbuttons = Math.ceil(student_list.length / items_per_page); + let pagination_div = document.querySelector('.pagination'); // iteate and create buttons as needed.