1;(function ($, window, document, undefined) { 2 'use strict'; 3 4 Foundation.libs.offcanvas = { 5 name : 'offcanvas', 6 7 version : '5.3.2', 8 9 settings : { 10 open_method: 'move', 11 close_on_click: false 12 }, 13 14 init : function (scope, method, options) { 15 this.bindings(method, options); 16 }, 17 18 events : function () { 19 var self = this, 20 S = self.S, 21 move_class = '', 22 right_postfix = '', 23 left_postfix = ''; 24 25 if (this.settings.open_method === 'move') { 26 move_class = 'move-'; 27 right_postfix = 'right'; 28 left_postfix = 'left'; 29 } else if (this.settings.open_method === 'overlap') { 30 move_class = 'offcanvas-overlap'; 31 } 32 33 S(this.scope).off('.offcanvas') 34 .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) { 35 self.click_toggle_class(e, move_class + right_postfix); 36 }) 37 .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) { 38 var settings = self.get_settings(e); 39 if (settings.close_on_click) { 40 self.hide.call(self, move_class + right_postfix, self.get_wrapper(e)); 41 } 42 }) 43 .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) { 44 self.click_toggle_class(e, move_class + left_postfix); 45 }) 46 .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) { 47 var settings = self.get_settings(e); 48 if (settings.close_on_click) { 49 self.hide.call(self, move_class + left_postfix, self.get_wrapper(e)); 50 } 51 }) 52 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) { 53 self.click_remove_class(e, move_class + left_postfix); 54 if (right_postfix) self.click_remove_class(e, move_class + right_postfix); 55 }); 56 57 }, 58 59 toggle: function(class_name, $off_canvas) { 60 $off_canvas = $off_canvas || this.get_wrapper(); 61 if ($off_canvas.is('.' + class_name)) { 62 this.hide(class_name, $off_canvas); 63 } else { 64 this.show(class_name, $off_canvas); 65 } 66 }, 67 68 show: function(class_name, $off_canvas) { 69 $off_canvas = $off_canvas || this.get_wrapper(); 70 $off_canvas.trigger('open').trigger('open.fndtn.offcanvas'); 71 $off_canvas.addClass(class_name); 72 }, 73 74 hide: function(class_name, $off_canvas) { 75 $off_canvas = $off_canvas || this.get_wrapper(); 76 $off_canvas.trigger('close').trigger('close.fndtn.offcanvas'); 77 $off_canvas.removeClass(class_name); 78 }, 79 80 click_toggle_class: function(e, class_name) { 81 e.preventDefault(); 82 var $off_canvas = this.get_wrapper(e); 83 this.toggle(class_name, $off_canvas); 84 }, 85 86 click_remove_class: function(e, class_name) { 87 e.preventDefault(); 88 var $off_canvas = this.get_wrapper(e); 89 this.hide(class_name, $off_canvas); 90 }, 91 92 get_settings: function(e) { 93 var offcanvas = this.S(e.target).closest('[' + this.attr_name() + ']'); 94 return offcanvas.data(this.attr_name(true) + '-init') || this.settings; 95 }, 96 97 get_wrapper: function(e) { 98 var $off_canvas = this.S(e ? e.target : this.scope).closest('.off-canvas-wrap'); 99 100 if ($off_canvas.length === 0) { 101 $off_canvas = this.S('.off-canvas-wrap'); 102 } 103 return $off_canvas; 104 }, 105 106 reflow : function () {} 107 }; 108}(jQuery, window, window.document));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.