Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,29 @@ for (let i = 0; i < navigationLinks.length; i++) {
}
}

// function search_game() {
// let input = document.getElementById("searchbar").value;
// input = input.toLowerCase();
// // let searchelement = document.getElementsByClassName("project-item active");
// let searchelement = document.querySelectorAll(".project-item");
// for (let i = 0; i < searchelement.length; i++) {
// if (!searchelement[i].innerHTML.toLowerCase().includes(input)) {
// searchelement[i].style.display = "none";
// } else {
// searchelement[i].style.display = "list-item";
// }
// }
// }

function search_game() {
let input = document.getElementById("searchbar").value;
input = input.toLowerCase();
let searchelement = document.getElementsByClassName("project-item active");
let input = document.getElementById("searchbar").value.toLowerCase();
let searchelement = document.querySelectorAll(".project-item");
for (let i = 0; i < searchelement.length; i++) {
if (!searchelement[i].innerHTML.toLowerCase().includes(input)) {
searchelement[i].style.display = "none";
} else {
let text = searchelement[i].innerText.toLowerCase();
if (text.includes(input)) {
searchelement[i].style.display = "list-item";
} else {
searchelement[i].style.display = "none";
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@

<div class="search-container" id="search-container-id">

<input type="text" class="search-input" placeholder="🕹️ Search for Games..." id="searchbar">

<!-- <input type="text" class="search-input" placeholder="🕹️ Search for Games..." id="searchbar"> -->
<input type="text" class="search-input" placeholder="🕹️ Search for Games..." id="searchbar" onkeyup="search_game()">
<div class="search-btn">
<i class="fa fa-search" aria-hidden="true"></i>
<div class="favorites-link">
Expand Down
Loading