Skip to content

Instantly share code, notes, and snippets.

@robdecker
Created November 24, 2020 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robdecker/4da5d336291967ea9b3b53e7db20a9cd to your computer and use it in GitHub Desktop.
Save robdecker/4da5d336291967ea9b3b53e7db20a9cd to your computer and use it in GitHub Desktop.
[Prevent the Administrative Toolbar from popping out as a sidebar when screen width is reduced] #d8
(function($, Drupal, document, window) {
/**
* Prevents the Administrative Toolbar from popping out as a sidebar when
* screen width is reduced.
*/
Drupal.behaviors.customToolbarResizeTweak = {
attach: function (context) {
window.matchMedia('(min-width: 975px)').addListener(function(event) {
event.matches ? $('#toolbar-item-administration', context).click() : $('.toolbar-item.is-active', context).click();
});
}
}
}(jQuery, Drupal, document, window));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment