Fix courses visibility toggler button (#257)

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
Emruz Hossain 2021-03-23 21:46:41 +06:00 committed by GitHub
parent cf88e95782
commit 2af89479be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 68 additions and 24 deletions

View file

@ -139,7 +139,7 @@ function toggleTOC() {
}
// Show more rows in the taken courses table
function showMoreCourses(elem) {
function toggleCourseVisibility(elem) {
// find the courses
let courses = elem.parentNode.getElementsByClassName("course");
@ -154,11 +154,12 @@ function showMoreCourses(elem) {
}
}
// toggle the button text
let btnText = elem.innerText;
if (btnText == "Show More") {
elem.innerText = "Show Less";
} else {
elem.innerText = "Show More";
// toggle the current button visibility
elem.classList.toggle("hidden");
// toggle the alternate button visibility
if (elem.id === "show-more-btn"){
document.getElementById("show-less-btn").classList.toggle("hidden");
}else{
document.getElementById("show-more-btn").classList.toggle("hidden");
}
}