Sha256: ebaff449d2be6fa37753a48831458c0d7ad2a1f823654a2966b35f77050d29a4

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

(function(){

  Sidebar = Base.extend({

    $body: null,
    $overlay: null,
    $sidebar: null,
    $sidebarHeader: null,
    $sidebarImg: null,
    $toggleButton: null,

    constructor: function(){
      this.$body = $('body');
      this.$overlay = $('.sidebar-overlay');
      this.$sidebar = $('#sidebar');
      this.$sidebarHeader = $('#sidebar .sidebar-header');
      this.$toggleButton = $('.navbar-toggle');
      this.sidebarImg = this.$sidebarHeader.css('background-image');

      this.addEventListeners();
    },

    addEventListeners: function(){
      var _this = this;

      _this.$toggleButton.on('click', function() {
        _this.$sidebar.toggleClass('open');
        if ((_this.$sidebar.hasClass('sidebar-fixed-left') || _this.$sidebar.hasClass('sidebar-fixed-right')) && _this.$sidebar.hasClass('open')) {
          _this.$overlay.addClass('active');
          _this.$body.css('overflow', 'hidden');
        } else {
          _this.$overlay.removeClass('active');
          _this.$body.css('overflow', 'auto');
        }

        return false;
      });

      _this.$overlay.on('click', function() {
        $(this).removeClass('active');
        _this.$body.css('overflow', 'auto');
        _this.$sidebar.removeClass('open');
      });
    }

  });

  window.Sidebar = Sidebar;

})();

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/website/source/assets/javascripts/app/_sidebar.js
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/website/source/assets/javascripts/app/_sidebar.js
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/website/source/assets/javascripts/app/_sidebar.js
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/website/source/assets/javascripts/app/_sidebar.js