71293844fe39e09fd90f48396d5ee71f56e394ac
[yaffs-website] / web / core / modules / toolbar / js / views / BodyVisualView.js
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
8 (function ($, Drupal, Backbone) {
9   Drupal.toolbar.BodyVisualView = Backbone.View.extend({
10     initialize: function initialize() {
11       this.listenTo(this.model, 'change:activeTray ', this.render);
12       this.listenTo(this.model, 'change:isFixed change:isViewportOverflowConstrained', this.isToolbarFixed);
13     },
14     isToolbarFixed: function isToolbarFixed() {
15       var isViewportOverflowConstrained = this.model.get('isViewportOverflowConstrained');
16       $('body').toggleClass('toolbar-fixed', isViewportOverflowConstrained || this.model.get('isFixed'));
17     },
18     render: function render() {
19       $('body').toggleClass('toolbar-tray-open', !!this.model.get('activeTray'));
20     }
21   });
22 })(jQuery, Drupal, Backbone);