Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Fixed Search Bar in apps
Browse files Browse the repository at this point in the history
  • Loading branch information
The Unblocked Hub committed Nov 6, 2023
1 parent c651559 commit 3439ac5
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions static/ocean.html
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@
</div>
</div>
<!-- Add more card elements here -->

<!-- External Scripts -->

<!-- Google tag (gtag.js) -->
Expand All @@ -425,16 +426,17 @@
<!-- Custom Script -->
<script>
function searchAnimal() {
const searchbar = document.getElementById("searchbar");
if (searchbar.value === '') {
// Code to execute if input field is empty
searchbar.style.width = "25%";
searchbar.style.height = "60px";
} else {
// Code to execute if input field is not empty
searchbar.style.width = "70%";
searchbar.style.height = "60px";
}
const searchValue = document.getElementById("searchbar").value.toLowerCase();
const cards = document.querySelectorAll('.card.animals');

cards.forEach(card => {
const cardText = card.querySelector('p3').textContent.toLowerCase();
if (cardText.includes(searchValue)) {
card.style.display = "block";
} else {
card.style.display = "none";
}
});
}
</script>
<footer>Copyright &copy; 2023 The Unblocked Hub</footer>
Expand Down

0 comments on commit 3439ac5

Please sign in to comment.