Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

add navbar active

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

active class nav

$('.nav-list li').click(function() {

    $('.nav-list li.active').removeClass('active');
    $(this).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
Javascript :: add svg in react 
Javascript :: convert json / array to excel in javascript 
Javascript :: threejs perspectivecamera 
Javascript :: how custom angular material component date format 
Javascript :: javascript minute and second to convert seconds 
Javascript :: bin to bit string javascript 
Javascript :: how to get promise state in js 
Javascript :: route guard in react js 
Javascript :: flat function javascript 
Javascript :: jest test navlink 
Javascript :: how to return json data from mvc controller to view 
Javascript :: javascript bool 
Javascript :: how to slice array in angular 6 
Javascript :: why we use mongoose 
Javascript :: trim string and place ... javascript 
Javascript :: object literal js 
Javascript :: how to aadd variable in html tag in js 
Javascript :: how to validate password and confirm password on react form hook 
Javascript :: shadow react native generator 
Javascript :: settings.json in vscode 
Javascript :: js range similar to python 
Javascript :: how to highlight active screen react native 
Javascript :: jquery select input value empty and hasclass 
Javascript :: function inside a class component react 
Javascript :: como bugar o javascript 
Javascript :: how to navigate to another page with settimeout reactjs 
Javascript :: window.open 
Javascript :: how to convert string to toggle case in javascript 
Javascript :: how to convert string to invert case in javascript 
Javascript :: attr jquery 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =