1 // http://civicrm.org/licensing
3 // When on a CiviCRM page the CiviCRM toolbar tab should be active
4 localStorage
.setItem('Drupal.toolbar.activeTabID', JSON
.stringify('toolbar-item-civicrm'));
7 function adjustToggle() {
8 if ($(window
).width() < 768 && $('#toolbar-item-civicrm').length
) {
9 $('#civicrm-menu-nav .crm-menubar-toggle-btn').css({
10 left
: '' + $('#toolbar-item-civicrm').offset().left
+ 'px',
11 width
: '' + $('#toolbar-item-civicrm').innerWidth() + 'px'
15 $(window
).resize(adjustToggle
);
16 $(document
).on('crmLoad', adjustToggle
);
18 // Wait for document.ready so Drupal's jQuery is available to this script
20 // If Drupal's jQuery isn't loaded (e.g. on a stripped-down front-end page), we don't need to worry about the toolbar
22 // This event is only triggered by Drupal's copy of jQuery. CRM.$ won't pick it up.
23 jQuery(document
).on('drupalToolbarTabChange', function (event
, tab
) {
24 if (CRM
.menubar
&& CRM
.menubar
.position
=== 'below-cms-menu') {
25 var action
= jQuery(tab
).is('#toolbar-item-civicrm') ? 'show' : 'hide';
26 CRM
.menubar
[action
]();