3

I'm using Drupal 8.4.2 lightning-8.x-2.23 and Boostrap subtheme, Admin Toolbar. The body class has an injected class of padding-top: 40.4px; for publisher user and padding-top: 79.4px; for admins. I want to make it the same padding. Does anybody know where this style is coming from? I dont see it in any style sheet. In Drupal 7 the admin toolbar had a settings page that allowed for padding top so that it pushes the body below the toolbar.

Logged in as admin body class

<body class="toolbar-tray-open toolbar-horizontal toolbar-fixed user-logged-
in path-workbench has-glyphicons" style="padding-top: 79.4px;">

Logged in as publisher body class

<body class="toolbar-tray-open toolbar-horizontal toolbar-fixed user-logged-
in path-workbench has-glyphicons" style="padding-top: 40.4px;">
2

It is being done by the core toolbar module. See updateToolbarHeight in core/modules/toolbar/js/views/ToolbarVisualView.js.

updateToolbarHeight: function updateToolbarHeight() {
  var toolbarTabOuterHeight = $('#toolbar-bar').find('.toolbar-tab').outerHeight() || 0;
  var toolbarTrayHorizontalOuterHeight = $('.is-active.toolbar-tray-horizontal').outerHeight() || 0;
  this.model.set('height', toolbarTabOuterHeight + toolbarTrayHorizontalOuterHeight);

  $('body').css({
    'padding-top': this.model.get('height')
  });

  this.triggerDisplace();
},
1
  • Thank you Chance G. Its done automatically now. I have different padding for admin then for all other users. So my workaround was to add a body class for which user they are .role-group_user is now added for all non-admin users. Then I nested a css class to add mode padding for non-admin users. Now both users have the same padding. Jan 5 '18 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.