Skip to content

Commit 6ec4991

Browse files
committed
style: in mobile portrait visualizza barra dei plugin sopra al contenuto
1 parent a79d13e commit 6ec4991

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

assets/src/js/base/sidebar.js

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
34
* Copyright (C) DevCode s.r.l.
@@ -131,7 +132,10 @@ $(document).ready(function () {
131132
});
132133
}, 150);
133134

134-
$("aside.content-sidebar, section.content, .main-footer, .control-sidebar-button").toggleClass("with-control-sidebar");
135+
if (!isMobilePortrait()) {
136+
$("aside.content-sidebar, section.content, .main-footer, .control-sidebar-button")
137+
.toggleClass("with-control-sidebar");
138+
}
135139
$(".control-sidebar-button i").toggleClass("fa-chevron-right").toggleClass("fa-chevron-left");
136140

137141
toggleControlSidebar();
@@ -158,7 +162,30 @@ $(document).ready(function () {
158162
}, 100);
159163
}
160164
});
165+
// Mobile portrait: aggiorna comportamento quando cambia risoluzione/orientamento
166+
$(window).on('resize orientationchange', function() {
167+
const sidebar = $(".control-sidebar");
168+
if (!sidebar.hasClass('control-sidebar-open')) return;
169+
170+
const elements = $("aside.content-sidebar, section.content, .main-footer, .control-sidebar-button");
161171

172+
if (isMobilePortrait()) {
173+
// Mobile portrait: rimuovi shift, overlay
174+
elements.removeClass('with-control-sidebar');
175+
} else {
176+
// Desktop/tablet: applica shift
177+
elements.addClass('with-control-sidebar');
178+
}
179+
});
180+
181+
// Mobile portrait: chiudi al tap fuori dalla barra
182+
$(document).on('touchstart', function(e) {
183+
if (!isMobilePortrait()) return;
184+
const $t = $(e.target);
185+
if ($t.closest('.control-sidebar').length || $t.closest('.control-sidebar-button').length) return;
186+
$(".control-sidebar").removeClass("control-sidebar-open");
187+
$(".control-sidebar-button i").removeClass('fa-chevron-left').addClass('fa-chevron-right');
188+
});
162189
// Disabilita definitivamente AdminLTE treeview dopo il caricamento
163190
setTimeout(function() {
164191
// Rimuove tutti i gestori di AdminLTE sui treeview
@@ -188,4 +215,8 @@ function toggleControlSidebar() {
188215
} else {
189216
button.css("background-color", "#fff");
190217
}
191-
}
218+
}
219+
220+
function isMobilePortrait() {
221+
return window.innerWidth <= 768 && window.innerHeight > window.innerWidth;
222+
}

0 commit comments

Comments
 (0)