1
+
1
2
/*
2
3
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
3
4
* Copyright (C) DevCode s.r.l.
@@ -131,7 +132,10 @@ $(document).ready(function () {
131
132
} ) ;
132
133
} , 150 ) ;
133
134
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
+ }
135
139
$ ( ".control-sidebar-button i" ) . toggleClass ( "fa-chevron-right" ) . toggleClass ( "fa-chevron-left" ) ;
136
140
137
141
toggleControlSidebar ( ) ;
@@ -158,7 +162,30 @@ $(document).ready(function () {
158
162
} , 100 ) ;
159
163
}
160
164
} ) ;
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" ) ;
161
171
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
+ } ) ;
162
189
// Disabilita definitivamente AdminLTE treeview dopo il caricamento
163
190
setTimeout ( function ( ) {
164
191
// Rimuove tutti i gestori di AdminLTE sui treeview
@@ -188,4 +215,8 @@ function toggleControlSidebar() {
188
215
} else {
189
216
button . css ( "background-color" , "#fff" ) ;
190
217
}
191
- }
218
+ }
219
+
220
+ function isMobilePortrait ( ) {
221
+ return window . innerWidth <= 768 && window . innerHeight > window . innerWidth ;
222
+ }
0 commit comments