Skip to content

Commit 7e34122

Browse files
authored
Merge pull request #440 from satyamra1/main
Update Search bar functionality in Devotional resource section
2 parents 7d8b474 + 585cbac commit 7e34122

1 file changed

Lines changed: 34 additions & 29 deletions

File tree

devotional-resources.html

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111

112112
.navigation .navbar {
113113
display: flex;
114-
/* margin-right: 350px !important; */
114+
margin-right: 350px !important;
115115
}
116116
.navigation .navbar a {
117117
color: #fff;
@@ -426,7 +426,9 @@
426426
</style>
427427
</head>
428428
<body>
429-
<button id="scrollTopBtn" class="scroll-top-btn"> <i class="fas fa-arrow-up"></i></button>
429+
<button id="scrollTopBtn" class="scroll-top-btn">
430+
<i class="fas fa-arrow-up"></i>
431+
</button>
430432
<div class="header">
431433
<div class="navigation">
432434
<div class="homeDiv">
@@ -438,19 +440,18 @@
438440
<a href="scriptures.html">Scriptures</a>
439441
<a href="gallery.html">Gallery</a>
440442
<a href="#" onclick="showLoginForm()">Discussion Forum</a>
441-
<a href="devotional-resources.html" id="active"
442-
>Devotional Resources</a
443-
>
444-
<a href="avatars.html">Avatars</a>
443+
<a href="devotional-resources.html" id="active">Devotional Resources</a>
445444
</div>
446445
</div>
447-
<form class="searchForm">
446+
<form class="searchForm" onsubmit="return false;">
448447
<input
449448
type="text"
449+
id="searchInput"
450450
class="searchInput"
451451
placeholder="Search all the content"
452+
onkeyup="searchResources()"
452453
/>
453-
<button><i class="fa-solid fa-magnifying-glass"></i></button>
454+
<button type="button"><i class="fa-solid fa-magnifying-glass"></i></button>
454455
</form>
455456
</div>
456457
</div>
@@ -511,9 +512,7 @@ <h2>Morning Mantras Audio</h2>
511512
Shree Krishna. Listen to the divine vibrations and bring positivity
512513
to your mornings.
513514
</p>
514-
<a href="./morning-mantra-audio.html" class="cta-button"
515-
>Listen Now</a
516-
>
515+
<a href="./morning-mantra-audio.html" class="cta-button">Listen Now</a>
517516
</div>
518517

519518
<!-- Resource 5 Card -->
@@ -524,8 +523,7 @@ <h2>Shri Radha Chalisa PDF</h2>
524523
href="./pdf_files/Shree-Radha-Chalisa.pdf"
525524
class="cta-button"
526525
download
527-
>Download Now</a
528-
>
526+
>Download Now</a>
529527
</div>
530528

531529
<!-- Resource 6 Card -->
@@ -547,11 +545,10 @@ <h2>Divine and beautiful wallpapers</h2>
547545

548546
<footer>
549547
<div class="footer-content">
550-
<div class="footer-section statement ">
551-
<h3>Statement on Faith </h3>
548+
<div class="footer-section statement">
549+
<h3>Statement on Faith</h3>
552550
<p class="faith-statement">
553551
Faith isn't just about something we believe; it is integral to our very existence, it's about how we live...
554-
555552
</p>
556553
<a href="devotional-resources.html" class="read-more">Read More</a>
557554
</div>
@@ -575,25 +572,17 @@ <h3>Contact Us</h3>
575572
<div class="footer-section">
576573
<h3>Follow Us</h3>
577574
<div class="social-icons">
578-
<a href="https://github.com/vishal02527" target="_blank"
579-
><i class="fa-brands fa-github"></i
580-
></a>
581-
<a href="https://codepen.io/Vishal-Kumar25" target="_blank"
582-
><i class="fa-brands fa-codepen"></i
583-
></a>
584-
<a
585-
href="https://www.linkedin.com/in/vishal-kumar-8303a3283"
586-
target="_blank"
587-
><i class="fa-brands fa-linkedin"></i
588-
></a>
575+
<a href="https://github.com/vishal02527" target="_blank"><i class="fa-brands fa-github"></i></a>
576+
<a href="https://codepen.io/Vishal-Kumar25" target="_blank"><i class="fa-brands fa-codepen"></i></a>
577+
<a href="https://www.linkedin.com/in/vishal-kumar-8303a3283" target="_blank"><i class="fa-brands fa-linkedin"></i></a>
589578
</div>
590579
</div>
591580
</div>
592581
<div class="creatorDiv">
593582
<p>&copy; All rights reserved 2023, Created by Vishal.</p>
594583
</div>
595584
</footer>
596-
<script src="script.js"></script>
585+
597586
<script>
598587
window.onscroll = function () {
599588
toggleScrollTopButton();
@@ -615,6 +604,22 @@ <h3>Follow Us</h3>
615604
scrollTopBtn.onclick = function () {
616605
window.scrollTo({ top: 0, behavior: "smooth" }); // Smooth scroll to top
617606
};
607+
608+
// Function to filter resources by search input
609+
function searchResources() {
610+
const input = document.getElementById('searchInput').value.toLowerCase();
611+
const resourceCards = document.querySelectorAll('.resource-card');
612+
613+
resourceCards.forEach(function(card) {
614+
const title = card.querySelector('h2').textContent.toLowerCase();
615+
if (title.includes(input)) {
616+
card.style.display = '';
617+
} else {
618+
card.style.display = 'none';
619+
}
620+
});
621+
}
618622
</script>
619-
</body>
623+
</body>
624+
620625
</html>

0 commit comments

Comments
 (0)