Search
 
SCRIPT & CODE EXAMPLE
 

PHP

active menu item css

//unfocused

.menuItem{
	background-color:red;
}


//focused
.menuItem:Focus{
	background-color:blue;
}
Comment

add active in nav

$(document).ready(function() {
    $('a[href$="' + location.pathname + '"]').addClass('active');
});
Comment

How to add .active class to active menu item

<?php
add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);
function special_nav_class($classes, $item){
     if( in_array('current-menu-item', $classes) ){
             $classes[] = 'active ';
     }
     return $classes;
}
Comment

Active class in menu section

// active class in menu section
// first
@php
    $route = Route::current()->getName();
@endphp
// 2nd
<li class="{{ ($route == 'home') ? 'active' : ''  }}"><a href="{{ route('home') }}">Home</a></li>
Comment

PREVIOUS NEXT
Code Example
Php :: get firstwod php 
Php :: Laravel how to use @auth and @guest with multi authentication 
Php :: What’s New in PHP 8 
Php :: download html table to excel 
Php :: how to add drop a table in phpmyadmin 
Php :: laravel find 
Php :: php array_search 
Php :: merge strings in php 
Php :: how to store wp editor in wordpress 
Php :: cron job setting for laravel in cpanel 
Php :: all() in laravel 
Php :: return last inserted id mysql opencart 
Php :: Add Custom Field to woocommerce Subscriptions 
Php :: cara looping abjad with range no kapital 
Php :: php echo "<style" posts css text 
Php :: Users/admin/Library/Caches/composer/files/laravel/laravel/1548f0533da115f0828fab4ef0c3923cd57879b6.zip): Failed to open stream: Permission denied 
Php :: myr currency symbol 
Php :: how to get keys of associative array php 
Php :: php datenbank beschreiben 
Php :: cpt change link 
Php :: wp query compare like and or 
Php :: php blade first child @foreach 
Php :: Laravel You may determine if a template inheritance section has content using the @hasSection directive: 
Php :: set renew subscroption stripe update 
Php :: php import 
Php :: lastPage does not exist. 
Php :: laravel relationship example 
Php :: laravel 8 remove public from url 
Php :: phplinit config 
Php :: Gsuite integration in Laravel PHP 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =