Reputation: 121
I am in charge of getting the mobile navigation on the site to work as intended but I have come into a bit of a problem.
This is a link to my code, the thing is that it looks how I want it too and the functionality is kind of there what I want it to do is when it drops down that the navigation bar takes up 100% of the screen rather than activating the scroll bar.
I have already tried using the code: overflow: hidden;
and overflow-y: hidden;
Neither of these have worked. if the link has expired some code is provided below.
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal">×</button>
<h4 class="modal-title">Session Timeout</h4>
</div>
<div class="modal-body">
<p>
<label>Your session has not been refreshed for 20 minutes, you will be logged out after 30 seconds. If you wish to continue working click the button below.</label>
</p>
</div>
<div class="modal-footer">
<asp:button class="btn btn-default" id="Button1" data-dismiss="modal" onclientclick="stopTimer('<%= FinalTimer.ClientID %>')" text="Continue Working" runat="server">
</asp:button></div>
</div>
</div>
</div>
<div class="navbar navbar-inverse navbar-fixed-top">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-target=".navbar-collapse" data-toggle="collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse">
<div id="MainMenu">
<div class="list-group panel">
<a class="list-group-item list-group-item-success" href="#demo3" data-toggle="collapse" data-parent="#MainMenu">Admin</a>
<div class="collapse" id="demo3">
<a class="list-group-item1" href="#SubMenu1" data-toggle="collapse" data-parent="#SubMenu1">Placements<i class="fa fa-caret-down"></i></a>
<div class="collapse list-group-submenu" id="SubMenu1">
<a class="list-group-item2" href="#" data-parent="#SubMenu1">New placement</a>
<a class="list-group-item2" href="#" data-parent="#SubMenu1">End Placement</a>
<a class="list-group-item2" href="#" data-parent="#SubMenu1">New Referal</a>
<a class="list-group-item2" href="#" data-parent="#SubMenu1">End Referal</a>
</div>
<a class="list-group-item1" href="#SubMenu2" data-toggle="collapse" data-parent="#SubMenu2">Appliences<i class="fa fa-caret-down"></i></a>
<div class="collapse list-group-submenu" id="SubMenu2">
<a class="list-group-item2" href="#" data-parent="#SubMenu2">Fridge</a>
<a class="list-group-item2" href="#" data-parent="#SubMenu2">Freezer</a>
</div>
<a class="list-group-item1" href="javascript:;">Backgrounds</a>
</div>
<a class="list-group-item list-group-item-success" href="#demo4" data-toggle="collapse" data-parent="#MainMenu">Item 4</a>
<div class="collapse" id="demo4">
<a class="list-group-item1" href="">Subitem 1</a>
<a class="list-group-item1" href="">Subitem 2</a>
<a class="list-group-item1" href="">Subitem 3</a>
</div>
</div>
</div>
<ul class="nav navbar-nav navbar-right">
<li>
<asp:loginview runat="server" viewstatemode="Disabled">
<anonymoustemplate>
<ul class="nav navbar-nav navbar-right">
<li><a href="~/Account/Login" runat="server">Log in</a></li>
</ul>
</anonymoustemplate>
<loggedintemplate>
<ul class="nav navbar-nav navbar-right">
<li>
<asp:loginstatus runat="server" onloggingout="Unnamed_LoggingOut" logoutpageurl="~/" logouttext="Log off" logoutaction="Redirect">
</asp:loginstatus></li>
</ul>
</loggedintemplate>
</asp:loginview>
</li>
</ul>
</div>
</nav>
</div>
.navbar {
position: relative;
min-height: 50px;
border: 1px solid transparent;
overflow-x:hidden;
overflow-y:hidden;
max-height:100%;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
any advice on this would be amazing.
Upvotes: 2
Views: 99
Reputation: 614
If you open up developer tools (F12 in Chrome/IE) and take a look at the computed tab for that element while it is expanded, you will see it has a max-height
set, which is what is causing the scroll bar.
To remove this, and have the max-height
as the full screen, add max-height
of 100vh to your CSS:
<div class="navbar-collapse collapse fullscreen-navbar-collapse">
.fullscreen-navbar-collapse {
max-height: 100vh;
}
If you only want it to this on smaller devices, wrap the CSS in a media query:
@media (max-width: 767px) {
.fullscreen-navbar-collapse {
max-height: 100vh;
}
}
Upvotes: 4