mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-19 22:53:03 +05:30
(fixed): navbar indicator not showing on new route based navigation
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
function isPageActive($pageName) {
|
function isPageActive($pageName, $pageRoute) {
|
||||||
$currentPage = $_SERVER['PHP_SELF'];
|
$currentPage = $_SERVER['PHP_SELF'];
|
||||||
if (strpos($currentPage, $pageName) !== false) {
|
$currentRoute = parse_url($_SERVER['REQUEST_URI'])['path'];
|
||||||
|
if (strpos($currentPage, $pageName) !== false || strpos($currentRoute, $pageRoute) !== false) {
|
||||||
|
if ($pageRoute == '/' && ($pos = strrpos($currentRoute, $pageRoute)) !== false && $pos < strlen($currentRoute) - 1) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
return 'w-full';
|
return 'w-full';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
@@ -15,15 +19,15 @@ function isPageActive($pageName) {
|
|||||||
<div class="widemenu mr-4 hidden lg:block">
|
<div class="widemenu mr-4 hidden lg:block">
|
||||||
<a class="mx-5 py-[0.30rem] relative group" href="<?php echo $basePath . '/projects' ?>">
|
<a class="mx-5 py-[0.30rem] relative group" href="<?php echo $basePath . '/projects' ?>">
|
||||||
Projects
|
Projects
|
||||||
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('projects.php');?> group-hover:w-full"></span>
|
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('projects.php', '/projects');?> group-hover:w-full"></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="mx-5 py-[0.30rem] relative group" href="<?php echo $basePath . '/blog' ?>">
|
<a class="mx-5 py-[0.30rem] relative group" href="<?php echo $basePath . '/blog' ?>">
|
||||||
Blog
|
Blog
|
||||||
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('blog.php');?> group-hover:w-full"></span>
|
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('blog.php', '/blog');?> group-hover:w-full"></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="mx-5 py-[0.30rem] relative group" href="<?php echo $basePath . '/contact' ?>">
|
<a class="mx-5 py-[0.30rem] relative group" href="<?php echo $basePath . '/contact' ?>">
|
||||||
Contact
|
Contact
|
||||||
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('contact.php');?> group-hover:w-full"></span>
|
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('contact.php', '/contact');?> group-hover:w-full"></span>
|
||||||
</a>
|
</a>
|
||||||
<button class="ml-5 px-3 py-1 border-[2px] border-accent_primary rounded-full hover:rounded-lg hover:shadow-lg hover:shadow-accent_primary_transparent transition transform duration-500" onclick="location.href='<?php echo $basePath . '/contact' ?>'">Let's Talk</button>
|
<button class="ml-5 px-3 py-1 border-[2px] border-accent_primary rounded-full hover:rounded-lg hover:shadow-lg hover:shadow-accent_primary_transparent transition transform duration-500" onclick="location.href='<?php echo $basePath . '/contact' ?>'">Let's Talk</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,19 +43,19 @@ function isPageActive($pageName) {
|
|||||||
<div class="mobilemenu flex flex-col mt-5" id="mobilemenu">
|
<div class="mobilemenu flex flex-col mt-5" id="mobilemenu">
|
||||||
<a class="ml-6 mb-4 py-[0.30rem] w-fit relative group" href="<?php echo $basePath ?>">
|
<a class="ml-6 mb-4 py-[0.30rem] w-fit relative group" href="<?php echo $basePath ?>">
|
||||||
Home Page
|
Home Page
|
||||||
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('index.php');?> group-hover:w-full"></span>
|
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('home.php', '/');?> group-hover:w-full"></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="ml-6 mb-4 py-[0.30rem] w-fit relative group" href="<?php echo $basePath . '/projects' ?>">
|
<a class="ml-6 mb-4 py-[0.30rem] w-fit relative group" href="<?php echo $basePath . '/projects' ?>">
|
||||||
My Projects
|
My Projects
|
||||||
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('projects.php');?> group-hover:w-full"></span>
|
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('projects.php', '/projects');?> group-hover:w-full"></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="ml-6 mb-4 py-[0.30rem] w-fit relative group" href="<?php echo $basePath . '/blog' ?>">
|
<a class="ml-6 mb-4 py-[0.30rem] w-fit relative group" href="<?php echo $basePath . '/blog' ?>">
|
||||||
My Blog
|
My Blog
|
||||||
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('blog.php');?> group-hover:w-full"></span>
|
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('blog.php', '/blog');?> group-hover:w-full"></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="ml-6 mb-4 py-[0.30rem] w-fit relative group" href="<?php echo $basePath . '/contact' ?>">
|
<a class="ml-6 mb-4 py-[0.30rem] w-fit relative group" href="<?php echo $basePath . '/contact' ?>">
|
||||||
Contact Me
|
Contact Me
|
||||||
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('contact.php');?> group-hover:w-full"></span>
|
<span class="absolute bottom-0 left-0 h-[2px] bg-accent_primary transition-all duration-300 w-0 <?php echo isPageActive('contact.php', '/contact');?> group-hover:w-full"></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ function perform_search(searchInput, searchDef, searchRes) {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { keyword: searchString },
|
data: { keyword: searchString },
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log("success");
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
},
|
},
|
||||||
error: function(error) {
|
error: function(error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user