Commit | Line | Data |
---|---|---|
7eed4524 | 1 | // http://civicrm.org/licensing |
7eed4524 | 2 | |
b30809e4 CW |
3 | // When on a CiviCRM page the CiviCRM toolbar tab should be active |
4 | localStorage.setItem('Drupal.toolbar.activeTabID', JSON.stringify('toolbar-item-civicrm')); | |
7eed4524 | 5 | |
b30809e4 CW |
6 | (function($) { |
7 | function adjustToggle() { | |
8 | if ($(window).width() < 768) { | |
9 | $('#civicrm-menu-nav .crm-menubar-toggle-btn').css({ | |
10 | left: '' + $('#toolbar-item-civicrm').offset().left + 'px', | |
11 | width: '' + $('#toolbar-item-civicrm').innerWidth() + 'px' | |
12 | }); | |
13 | } | |
14 | } | |
15 | $(window).resize(adjustToggle); | |
16 | $(document).on('crmLoad', adjustToggle); | |
17 | ||
18 | // Wait for document.ready so Drupal's jQuery is available to this script | |
19 | $(function($) { | |
20 | // Need Drupal's jQuery to listen to this event | |
21 | jQuery(document).on('drupalToolbarTabChange', function(event, tab) { | |
22 | if (CRM.menubar && CRM.menubar.position === 'below-cms-menu') { | |
23 | var action = jQuery(tab).is('#toolbar-item-civicrm') ? 'show' : 'hide'; | |
24 | CRM.menubar[action](); | |
25 | } | |
26 | }); | |
27 | }); | |
28 | ||
29 | })(CRM.$); |