Skip to content

Commit bb82dae

Browse files
committed
feat: sidebar set active using query string
1 parent a14b70d commit bb82dae

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

dist/js/coreui.js

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/coreui.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/coreui.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/coreui.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/sidebar.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const Sidebar = (($) => {
4747
NAV_DROPDOWN_TOGGLE : '.nav-dropdown-toggle',
4848
NAV_DROPDOWN_ITEMS : '.nav-dropdown-items',
4949
NAV_LINK : '.nav-link',
50+
NAV_LINK_QUERIED : '.nav-link-queried',
5051
NAVIGATION_CONTAINER : '.sidebar-nav',
5152
NAVIGATION : '.sidebar-nav > .nav',
5253
SIDEBAR : '.sidebar',
@@ -121,7 +122,13 @@ const Sidebar = (($) => {
121122
setActiveLink() {
122123
$(Selector.NAVIGATION).find(Selector.NAV_LINK).each((key, value) => {
123124
let link = value
124-
let cUrl = String(window.location).split('?')[0]
125+
126+
if (link.classList.contains(Selector.NAV_LINK_QUERIED)) {
127+
var cUrl = String(window.location);
128+
}
129+
else {
130+
var cUrl = String(window.location).split('?')[0];
131+
}
125132

126133
if (cUrl.substr(cUrl.length - 1) === '#') {
127134
cUrl = cUrl.slice(0, -1)

0 commit comments

Comments
 (0)