I have a reddit like top menu. the thing is there are too many items. How I can add a hamburger menu if screen size is x size but I don’t want to take all the items into hamburger menu. just menu items which don’t fit the screen.
The menu expands like this if you change the screen size
and if you change the screen size to smaller size all the items hidden into hamburger menu.
For example on a particular screen size how can I hide search box and some items into hamburger menu? It doesn’t even have to add into hamburger menu. how I can hide them entirely.
I have tried this approach
@media (min-width: 769px) {
.nav.navbar-nav > li {
display: none;
}
.nav.navbar-nav > li:nth-child(1),
.nav.navbar-nav > li:nth-child(2),
.nav.navbar-nav > li:nth-child(3) {
display: block;
}
.lt-ie9 .nav.navbar-nav > li:first-child,
.lt-ie9 .nav.nav.navbar-nav > li:first-child + li,
.lt-ie9 .nav.navbar-nav > li:first-child + li + li {
display: block;
}
}
@media (max-width: 790px) {
.header-navbar .nav-icons,
.header-navbar .nav.navbar-nav > li.nav-all {
margin-right: 0px;
}
.header-navbar:after {
display: none;
}
}
@media (min-width: 899px) {
.nav.navbar-nav > li:nth-child(4) {
display: block;
}
.lt-ie9 .nav.navbar-nav > li:first-child + li + li + li {
display: block;
}
}
@media (min-width: 1200px) {
.nav.navbar-nav > li:nth-child(5),
.nav.navbar-nav > li:nth-child(6),
.nav.navbar-nav > li:nth-child(7),
.nav.navbar-nav > li:nth-child(8),
.nav.navbar-nav > li:nth-child(9),
.nav.navbar-nav > li:nth-child(10),
.nav.navbar-nav > li:nth-child(11),
.nav.navbar-nav > li:nth-child(12),
.nav.navbar-nav > li:nth-child(13),
.nav.navbar-nav > li:nth-child(14) {
display: block;
}
.lt-ie9 .nav.navbar-nav > li:first-child + li + li + li {
display: block;
}
}
2
Answers
Assuming your html follows standard structure for a Bootstrap navbar:
Have something like this:
Check the example in the emulator view.