[Tutorial] Active Menu
5 posters
Page 1 of 1
[Tutorial] Active Menu
Add an active class to the main menu
Watch the example:
All you have to do is create a new JavaScript (The placement: All pages).
(Optional) Simple css used in gif example:
Enjoy!
Watch the example:
All you have to do is create a new JavaScript (The placement: All pages).
- Code:
/*
* Application: Active Menu
* Date: 26/04/2018
* Version: 1.226042018
* Copyright (c) 2018 Daemon <help.forumotion.com>
* This work is free. You can redistribute it and/or modify it
*/
document.addEventListener("DOMContentLoaded", function(event) {
var location = window.location.pathname + window.location.search,
mainmenu = document.querySelector("a.mainmenu[href='" + location + "']");
if(mainmenu) mainmenu.className += " active";
});
(Optional) Simple css used in gif example:
- Code:
a.mainmenu.active {
background-color: white;
color: #000;
padding: 5px;
text-decoration: none !important;
font-weight: bold;
border-radius: 4px 4px 0 0;
}
Enjoy!
Last edited by Daemon on April 27th 2018, 7:30 pm; edited 4 times in total
Daemon- Forumember
- Posts : 104
Reputation : 91
Language : Português
Re: [Tutorial] Active Menu
So this script will let us open any nav bar link without refreshing the whole page?
If yes, great work thank you!
If yes, great work thank you!
Re: [Tutorial] Active Menu
SarkZKalie wrote:So this script will let us open any nav bar link without refreshing the whole page?
If yes, great work thank you!
No! The code just adds an "active" class to the menu link, as in the gif example.
Daemon- Forumember
- Posts : 104
Reputation : 91
Language : Português
Daemon- Forumember
- Posts : 104
Reputation : 91
Language : Português
Similar topics
» Most active topic & Most active forum in user profile
» Requesting Loading Screen Video tutorial or Tutorial
» [Menu] Sublevels/Submenus Below a Menu/Tab
» Mac Menu Based Menu
» Can I add a menu button on the top menu...?
» Requesting Loading Screen Video tutorial or Tutorial
» [Menu] Sublevels/Submenus Below a Menu/Tab
» Mac Menu Based Menu
» Can I add a menu button on the top menu...?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum