diff options
author | Camil Staps | 2015-03-19 22:32:18 +0100 |
---|---|---|
committer | Camil Staps | 2015-03-19 22:32:18 +0100 |
commit | a256f7bf12a4c65cbb7ce4551c7858454976ff3c (patch) | |
tree | ff9769ea09fea013855ff19aa17b895d65a62471 /js | |
parent | Collapse menu (diff) |
Collapsing is remembered during a session
Diffstat (limited to 'js')
-rw-r--r-- | js/businessadmin.js | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/js/businessadmin.js b/js/businessadmin.js index 34b20fb..a82be81 100644 --- a/js/businessadmin.js +++ b/js/businessadmin.js @@ -85,19 +85,37 @@ $(document).ready(function(){ // Collapse menu var collapsed = false; - $('#collapse-menu').click(function(){ + $('#collapse-menu').click(function(e, p){ + var animation = 200; + if (typeof p != 'undefined' && p.load) + animation = 0; + if (!collapsed) - $('.nav-title').hide(); + $('.nav-title').finish().hide(); $('.sidebar').animate({ width: collapsed ? 250 : 50 - }, 200); + }, animation); $('#page-wrapper').animate({ marginLeft: collapsed ? 250 : 50 - }, 200); + }, animation); if (collapsed) - $('.nav-title').delay(200).queue(function(){$(this).show()}); + $('.nav-title').finish().delay(animation).queue(function(){$(this).show()}); $(this).find('i.fa').removeClass('fa-caret-square-o-left fa-caret-square-o-right').addClass('fa-caret-square-o-' + (collapsed ? 'left' : 'right')); collapsed = !collapsed; + + $.ajax({ + url: const_url_external + 'ajax/collapse', + method: 'GET', + crossDomain: true, + cache: false, + xhrFields: { + withCredentials: true + }, + data: { + setting: collapsed + } + }); + return true; }); });
\ No newline at end of file |