From 132cfef4e904cf77b1a9d513c34adcaf76de295b Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 2 Oct 2019 12:56:19 +0200 Subject: [PATCH] #1304 Scroll Down en boton others client left menu --- front/salix/components/left-menu/left-menu.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/front/salix/components/left-menu/left-menu.js b/front/salix/components/left-menu/left-menu.js index 1df67f6d3..576dcc2df 100644 --- a/front/salix/components/left-menu/left-menu.js +++ b/front/salix/components/left-menu/left-menu.js @@ -2,7 +2,9 @@ import ngModule from '../../module'; import './style.scss'; export default class LeftMenu { - constructor($state, $transitions, aclService) { + constructor($state, $transitions, aclService, $timeout, $element) { + this.$element = $element; + this.$timeout = $timeout; this.$state = $state; this.deregisterCallback = $transitions.onSuccess({}, () => this.activateItem()); @@ -89,13 +91,19 @@ export default class LeftMenu { setActive(item) { if (item.state) return; item.active = !item.active; + + this.$timeout(() => { + let element = this.$element[0].querySelector('a[class="expanded"]'); + if (element) + element.scrollIntoView(); + }); } $onDestroy() { this.deregisterCallback(); } } -LeftMenu.$inject = ['$state', '$transitions', 'aclService']; +LeftMenu.$inject = ['$state', '$transitions', 'aclService', '$timeout', '$element']; ngModule.component('vnLeftMenu', { template: require('./left-menu.html'),