1;(function ($, window, document, undefined) { 2 'use strict'; 3 4 Foundation.libs.offcanvas = { 5 name : 'offcanvas', 6 7 version : '5.5.3', 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 top_postfix = '', 25 bottom_postfix = ''; 26 27 if (this.settings.open_method === 'move') { 28 move_class = 'move-'; 29 right_postfix = 'right'; 30 left_postfix = 'left'; 31 top_postfix = 'top'; 32 bottom_postfix = 'bottom'; 33 } else if (this.settings.open_method === 'overlap_single') { 34 move_class = 'offcanvas-overlap-'; 35 right_postfix = 'right'; 36 left_postfix = 'left'; 37 top_postfix = 'top'; 38 bottom_postfix = 'bottom'; 39 } else if (this.settings.open_method === 'overlap') { 40 move_class = 'offcanvas-overlap'; 41 } 42 43 S(this.scope).off('.offcanvas') 44 .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) { 45 self.click_toggle_class(e, move_class + right_postfix); 46 if (self.settings.open_method !== 'overlap') { 47 S('.left-submenu').removeClass(move_class + right_postfix); 48 } 49 $('.left-off-canvas-toggle').attr('aria-expanded', 'true'); 50 }) 51 .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) { 52 var settings = self.get_settings(e); 53 var parent = S(this).parent(); 54 55 if (settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')) { 56 self.hide.call(self, move_class + right_postfix, self.get_wrapper(e)); 57 parent.parent().removeClass(move_class + right_postfix); 58 } else if (S(this).parent().hasClass('has-submenu')) { 59 e.preventDefault(); 60 S(this).siblings('.left-submenu').toggleClass(move_class + right_postfix); 61 } else if (parent.hasClass('back')) { 62 e.preventDefault(); 63 parent.parent().removeClass(move_class + right_postfix); 64 } 65 $('.left-off-canvas-toggle').attr('aria-expanded', 'true'); 66 }) 67 //end of left canvas 68 .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) { 69 self.click_toggle_class(e, move_class + left_postfix); 70 if (self.settings.open_method !== 'overlap') { 71 S('.right-submenu').removeClass(move_class + left_postfix); 72 } 73 $('.right-off-canvas-toggle').attr('aria-expanded', 'true'); 74 }) 75 .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) { 76 var settings = self.get_settings(e); 77 var parent = S(this).parent(); 78 79 if (settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')) { 80 self.hide.call(self, move_class + left_postfix, self.get_wrapper(e)); 81 parent.parent().removeClass(move_class + left_postfix); 82 } else if (S(this).parent().hasClass('has-submenu')) { 83 e.preventDefault(); 84 S(this).siblings('.right-submenu').toggleClass(move_class + left_postfix); 85 } else if (parent.hasClass('back')) { 86 e.preventDefault(); 87 parent.parent().removeClass(move_class + left_postfix); 88 } 89 $('.right-off-canvas-toggle').attr('aria-expanded', 'true'); 90 }) 91 //end of right canvas 92 .on('click.fndtn.offcanvas', '.top-off-canvas-toggle', function (e) { 93 self.click_toggle_class(e, move_class + bottom_postfix); 94 if (self.settings.open_method !== 'overlap') { 95 S('.top-submenu').removeClass(move_class + bottom_postfix); 96 } 97 $('.top-off-canvas-toggle').attr('aria-expanded', 'true'); 98 }) 99 .on('click.fndtn.offcanvas', '.top-off-canvas-menu a', function (e) { 100 var settings = self.get_settings(e); 101 var parent = S(this).parent(); 102 103 if (settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')) { 104 self.hide.call(self, move_class + bottom_postfix, self.get_wrapper(e)); 105 parent.parent().removeClass(move_class + bottom_postfix); 106 } else if (S(this).parent().hasClass('has-submenu')) { 107 e.preventDefault(); 108 S(this).siblings('.top-submenu').toggleClass(move_class + bottom_postfix); 109 } else if (parent.hasClass('back')) { 110 e.preventDefault(); 111 parent.parent().removeClass(move_class + bottom_postfix); 112 } 113 $('.top-off-canvas-toggle').attr('aria-expanded', 'true'); 114 }) 115 //end of top canvas 116 .on('click.fndtn.offcanvas', '.bottom-off-canvas-toggle', function (e) { 117 self.click_toggle_class(e, move_class + top_postfix); 118 if (self.settings.open_method !== 'overlap') { 119 S('.bottom-submenu').removeClass(move_class + top_postfix); 120 } 121 $('.bottom-off-canvas-toggle').attr('aria-expanded', 'true'); 122 }) 123 .on('click.fndtn.offcanvas', '.bottom-off-canvas-menu a', function (e) { 124 var settings = self.get_settings(e); 125 var parent = S(this).parent(); 126 127 if (settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')) { 128 self.hide.call(self, move_class + top_postfix, self.get_wrapper(e)); 129 parent.parent().removeClass(move_class + top_postfix); 130 } else if (S(this).parent().hasClass('has-submenu')) { 131 e.preventDefault(); 132 S(this).siblings('.bottom-submenu').toggleClass(move_class + top_postfix); 133 } else if (parent.hasClass('back')) { 134 e.preventDefault(); 135 parent.parent().removeClass(move_class + top_postfix); 136 } 137 $('.bottom-off-canvas-toggle').attr('aria-expanded', 'true'); 138 }) 139 //end of bottom 140 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) { 141 self.click_remove_class(e, move_class + left_postfix); 142 S('.right-submenu').removeClass(move_class + left_postfix); 143 if (right_postfix) { 144 self.click_remove_class(e, move_class + right_postfix); 145 S('.left-submenu').removeClass(move_class + left_postfix); 146 } 147 $('.right-off-canvas-toggle').attr('aria-expanded', 'true'); 148 }) 149 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) { 150 self.click_remove_class(e, move_class + left_postfix); 151 $('.left-off-canvas-toggle').attr('aria-expanded', 'false'); 152 if (right_postfix) { 153 self.click_remove_class(e, move_class + right_postfix); 154 $('.right-off-canvas-toggle').attr('aria-expanded', 'false'); 155 } 156 }) 157 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) { 158 self.click_remove_class(e, move_class + top_postfix); 159 S('.bottom-submenu').removeClass(move_class + top_postfix); 160 if (bottom_postfix) { 161 self.click_remove_class(e, move_class + bottom_postfix); 162 S('.top-submenu').removeClass(move_class + top_postfix); 163 } 164 $('.bottom-off-canvas-toggle').attr('aria-expanded', 'true'); 165 }) 166 .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) { 167 self.click_remove_class(e, move_class + top_postfix); 168 $('.top-off-canvas-toggle').attr('aria-expanded', 'false'); 169 if (bottom_postfix) { 170 self.click_remove_class(e, move_class + bottom_postfix); 171 $('.bottom-off-canvas-toggle').attr('aria-expanded', 'false'); 172 } 173 }); 174 }, 175 176 toggle : function (class_name, $off_canvas) { 177 $off_canvas = $off_canvas || this.get_wrapper(); 178 if ($off_canvas.is('.' + class_name)) { 179 this.hide(class_name, $off_canvas); 180 } else { 181 this.show(class_name, $off_canvas); 182 } 183 }, 184 185 show : function (class_name, $off_canvas) { 186 $off_canvas = $off_canvas || this.get_wrapper(); 187 $off_canvas.trigger('open.fndtn.offcanvas'); 188 $off_canvas.addClass(class_name); 189 }, 190 191 hide : function (class_name, $off_canvas) { 192 $off_canvas = $off_canvas || this.get_wrapper(); 193 $off_canvas.trigger('close.fndtn.offcanvas'); 194 $off_canvas.removeClass(class_name); 195 }, 196 197 click_toggle_class : function (e, class_name) { 198 e.preventDefault(); 199 var $off_canvas = this.get_wrapper(e); 200 this.toggle(class_name, $off_canvas); 201 }, 202 203 click_remove_class : function (e, class_name) { 204 e.preventDefault(); 205 var $off_canvas = this.get_wrapper(e); 206 this.hide(class_name, $off_canvas); 207 }, 208 209 get_settings : function (e) { 210 var offcanvas = this.S(e.target).closest('[' + this.attr_name() + ']'); 211 return offcanvas.data(this.attr_name(true) + '-init') || this.settings; 212 }, 213 214 get_wrapper : function (e) { 215 var $off_canvas = this.S(e ? e.target : this.scope).closest('.off-canvas-wrap'); 216 217 if ($off_canvas.length === 0) { 218 $off_canvas = this.S('.off-canvas-wrap'); 219 } 220 return $off_canvas; 221 }, 222 223 reflow : function () {} 224 }; 225}(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.