mirror of https://github.com/akveo/blur-admin
fix(sidebar): use dynamic height for slimScroll
parent
c83ec6ad0b
commit
9d0c04a77f
|
@ -9,9 +9,10 @@
|
|||
.controller('SidebarCtrl', SidebarCtrl);
|
||||
|
||||
/** @ngInject */
|
||||
function SidebarCtrl($scope, $rootScope, $timeout, $location, layoutSizes, sidebarService) {
|
||||
function SidebarCtrl($scope, $rootScope, $timeout, $location, layoutSizes, sidebarService, $element) {
|
||||
|
||||
$scope.menuItems = sidebarService.getMenuItems();
|
||||
$scope.menuHeight = $element[0].childNodes[0].clientHeight - 84;
|
||||
|
||||
function changeSelectElemTopValue() {
|
||||
$timeout(function () {
|
||||
|
@ -58,12 +59,21 @@
|
|||
// watch window resize to change menu collapsed state if needed
|
||||
$(window).resize(function () {
|
||||
var isMenuShouldCollapsed = $(window).width() <= layoutSizes.resWidthCollapseSidebar;
|
||||
var scopeApplied = false;
|
||||
if ($scope.isMenuShouldCollapsed !== isMenuShouldCollapsed) {
|
||||
$scope.$apply(function () {
|
||||
$scope.menuHeight = $element[0].childNodes[0].clientHeight - 84;
|
||||
$scope.$isMenuCollapsed = isMenuShouldCollapsed;
|
||||
scopeApplied = true;
|
||||
});
|
||||
}
|
||||
if (!scopeApplied) {
|
||||
$scope.$apply(function () {
|
||||
$scope.menuHeight = $element[0].childNodes[0].clientHeight - 84;
|
||||
});
|
||||
}
|
||||
$scope.isMenuShouldCollapsed = isMenuShouldCollapsed;
|
||||
|
||||
});
|
||||
|
||||
$scope.toggleSubMenu = function ($event, item) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<aside class="al-sidebar" ng-swipe-right="menuExpand()" ng-swipe-left="menuCollapse()"
|
||||
ng-mouseleave="hoverElemTop=selectElemTop">
|
||||
<ul class="al-sidebar-list" slimscroll="{height: '100%'}">
|
||||
<ul class="al-sidebar-list" slimscroll="{height: '{{menuHeight}}px'}" slimscroll-watch="menuHeight" >
|
||||
<li ng-repeat="item in menuItems" class="al-sidebar-list-item"
|
||||
ng-class="{'selected': item.selected, 'with-sub-menu': item.subMenu}"
|
||||
ng-mouseenter="hoverItem($event, item)">
|
||||
|
|
Loading…
Reference in New Issue