Fix mobile navi

This commit is contained in:
digitaldonkey 2019-12-30 14:06:07 +01:00 committed by Igor Scheller
parent 61977f5da9
commit 2d9c722b3e
5 changed files with 93 additions and 11 deletions

View File

@ -90,9 +90,6 @@ $(function () {
return true; return true;
}); });
$('.dropdown-menu').css('max-height', function () {
return ($(window).height() - 50) + 'px';
}).css('overflow-y', 'scroll');
}); });
/* /*

View File

@ -0,0 +1,13 @@
;(function($, window, document, undefined) {
'use strict';
$(document).ready(function () {
$('[data-toggle="offcanvas"]').click(function () {
var button = $(this);
button.toggleClass('is-open')
$(button.attr('data-target')).toggleClass('in');
});
});
}(jQuery, window, window.document));

View File

@ -6,6 +6,7 @@ require('imports-loader?this=>window&define=>false&exports=>false!moment');
require('imports-loader?this=>window&define=>false&exports=>false!moment/locale/de'); require('imports-loader?this=>window&define=>false&exports=>false!moment/locale/de');
require('imports-loader?define=>false&exports=>false!eonasdan-bootstrap-datetimepicker'); require('imports-loader?define=>false&exports=>false!eonasdan-bootstrap-datetimepicker');
require('imports-loader?this=>window!chart.js'); require('imports-loader?this=>window!chart.js');
require('./offcanvas');
require('./forms'); require('./forms');
require('./sticky-headers'); require('./sticky-headers');
require('./moment-countdown'); require('./moment-countdown');

View File

@ -332,4 +332,72 @@ table a > .icon-icon_angel {
a[href]:after { a[href]:after {
content: ""; content: "";
} }
} }
.navbar-toggle {
transform: scale(1.25, 0.96);
padding: 2px 6px;
margin-top: 6px;
margin-bottom: 4px;
max-height: @navbar-height;
.icon {
border-color: @brand-primary;
font-weight: bold;
color: @brand-primary;
font-size: 25px;
&-close {
padding: 0 3px;
display: none;
}
}
&.is-open .icon {
&-open {
display: none;
}
&-close {
display: block;
}
}
}
@media screen and (max-width: @grid-float-breakpoint-max) {
#navbar-offcanvas {
display: block;
position: absolute;
width: 90%;
height: calc( 100vh - @navbar-height);
max-height: unset;
left: 101%;
top: @navbar-height + 1;
transition: left .3s ease-in-out;
-webkit-transition: left .3s ease-in-out;
background: @navbar-default-bg;
margin: 0 !important; // Overridden in theme with high specifity:
// .container > .navbar-header,
// .container-fluid > .navbar-header,
// .container > .navbar-collapse,
// .container-fluid > .navbar-collapse
// Is open
&.collapse.in {
left: 10%;
display: block;
overflow-y: auto;
box-shadow: -5px 20px 20px 0px rgba(0, 0, 0, 0.5), 5px 0 5px -5px rgba(0, 0, 0, 0.5);
}
// Hide current page in nav.
.nav > li.active {
display: none;
}
.caret {
float: right;
margin-top: 7px;
}
}
}

View File

@ -12,11 +12,12 @@
{% block navbar %} {% block navbar %}
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" <button type="button" class="navbar-toggle collapsed"
data-toggle="collapse" data-target="#navbar-collapse-1"> data-toggle="offcanvas" data-target="#navbar-offcanvas">
<span class="sr-only">Toggle navigation</span> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon icon-open">☰</span>
<span class="icon-bar"></span> <span class="icon icon-close">×</span>
<span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand" href="{{ url('/') }}"> <a class="navbar-brand" href="{{ url('/') }}">
<span class="icon-icon_angel"></span> <span class="icon-icon_angel"></span>
@ -25,7 +26,7 @@
</div> </div>
{% block menu %} {% block menu %}
<div class="collapse navbar-collapse" id="navbar-collapse-1"> <div class="collapse navbar-collapse" id="navbar-offcanvas">
{% block menu_items %} {% block menu_items %}
{{ menu() }} {{ menu() }}
@ -65,7 +66,7 @@
{{ _self.toolbar_item(user.name, url('users', {'action': 'view'}), 'users', 'icon icon-icon_angel') }} {{ _self.toolbar_item(user.name, url('users', {'action': 'view'}), 'users', 'icon icon-icon_angel') }}
{% endif %} {% endif %}
<li class="dropdown"> <li class="hidden-xs">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span> <span class="caret"></span>
</a> </a>
@ -73,7 +74,9 @@
{{ menuUserSubmenu()|join(" ")|raw }} {{ menuUserSubmenu()|join(" ")|raw }}
</ul> </ul>
</li> </li>
</ul>
<ul class="nav navbar-nav navbar-mobile hidden-sm hidden-md hidden-lg">
{{ menuUserSubmenu()|join(" ")|raw }}
</ul> </ul>
{% endblock %} {% endblock %}
</div> </div>