summaryrefslogtreecommitdiff
path: root/web-ui/app/js/foundation/off_canvas.js
blob: 7dfd6f34d498175083f9cdae8f110f7fbe9f5adc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
define(['flight/lib/component', 'page/events'], function (defineComponent, events) {

  return defineComponent(function() {

    this.toggleSlider = function (){
      $('.off-canvas-wrap').foundation('offcanvas', 'toggle', 'move-right');
    };

    this.closeSlider = function (){
      if ($('.off-canvas-wrap').attr('class').indexOf('move-right') > -1) {
        $('.off-canvas-wrap').foundation('offcanvas', 'toggle', 'move-right');
      }
    };

    this.after('initialize', function () {
      this.on($('.left-off-canvas-toggle'), 'click', this.toggleSlider);
      this.on($('#middle-pane-container'), 'click', this.closeSlider);
      this.on($('#right-pane'), 'click', this.closeSlider);
    });
  });
});