BodyVisualView.js 862 B

12345678910111213141516171819202122
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. (function ($, Drupal, Backbone) {
  8. Drupal.toolbar.BodyVisualView = Backbone.View.extend({
  9. initialize: function initialize() {
  10. this.listenTo(this.model, 'change:activeTray ', this.render);
  11. this.listenTo(this.model, 'change:isFixed change:isViewportOverflowConstrained', this.isToolbarFixed);
  12. },
  13. isToolbarFixed: function isToolbarFixed() {
  14. var isViewportOverflowConstrained = this.model.get('isViewportOverflowConstrained');
  15. $('body').toggleClass('toolbar-fixed', isViewportOverflowConstrained || this.model.get('isFixed'));
  16. },
  17. render: function render() {
  18. $('body').toggleClass('toolbar-tray-open', !!this.model.get('activeTray'));
  19. }
  20. });
  21. })(jQuery, Drupal, Backbone);