catscope 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/bower.json +1 -0
- data/assets/bower_components/foundation/LICENSE +22 -0
- data/assets/bower_components/foundation/README.md +46 -0
- data/assets/bower_components/foundation/bower.json +2 -4
- data/assets/bower_components/foundation/css/foundation.css +1695 -1230
- data/assets/bower_components/foundation/css/foundation.css.map +1 -1
- data/assets/bower_components/foundation/css/foundation.min.css +1 -0
- data/assets/bower_components/foundation/css/normalize.css +9 -12
- data/assets/bower_components/foundation/css/normalize.css.map +1 -1
- data/assets/bower_components/foundation/css/normalize.min.css +1 -0
- data/assets/bower_components/foundation/js/foundation/foundation.abide.js +171 -75
- data/assets/bower_components/foundation/js/foundation/foundation.accordion.js +70 -12
- data/assets/bower_components/foundation/js/foundation/foundation.alert.js +5 -5
- data/assets/bower_components/foundation/js/foundation/foundation.clearing.js +84 -40
- data/assets/bower_components/foundation/js/foundation/foundation.dropdown.js +104 -79
- data/assets/bower_components/foundation/js/foundation/foundation.equalizer.js +57 -26
- data/assets/bower_components/foundation/js/foundation/foundation.interchange.js +50 -38
- data/assets/bower_components/foundation/js/foundation/foundation.joyride.js +121 -110
- data/assets/bower_components/foundation/js/foundation/foundation.js +121 -79
- data/assets/bower_components/foundation/js/foundation/foundation.magellan.js +75 -59
- data/assets/bower_components/foundation/js/foundation/foundation.offcanvas.js +95 -22
- data/assets/bower_components/foundation/js/foundation/foundation.orbit.js +127 -123
- data/assets/bower_components/foundation/js/foundation/foundation.reveal.js +147 -69
- data/assets/bower_components/foundation/js/foundation/foundation.slider.js +101 -72
- data/assets/bower_components/foundation/js/foundation/foundation.tab.js +52 -39
- data/assets/bower_components/foundation/js/foundation/foundation.tooltip.js +97 -49
- data/assets/bower_components/foundation/js/foundation/foundation.topbar.js +70 -57
- data/assets/bower_components/foundation/js/foundation.js +1544 -951
- data/assets/bower_components/foundation/js/foundation.min.js +5 -4
- data/assets/bower_components/foundation/js/vendor/fastclick.js +8 -9
- data/assets/bower_components/foundation/js/vendor/jquery.js +6 -6
- data/assets/bower_components/foundation/js/vendor/modernizr.js +1 -1
- data/assets/bower_components/foundation/package.json +57 -0
- data/assets/bower_components/foundation/scss/foundation/_functions.scss +53 -43
- data/assets/bower_components/foundation/scss/foundation/_settings.scss +59 -37
- data/assets/bower_components/foundation/scss/foundation/components/_accordion.scss +12 -8
- data/assets/bower_components/foundation/scss/foundation/components/_alert-boxes.scss +12 -12
- data/assets/bower_components/foundation/scss/foundation/components/_block-grid.scss +14 -13
- data/assets/bower_components/foundation/scss/foundation/components/_breadcrumbs.scss +19 -19
- data/assets/bower_components/foundation/scss/foundation/components/_button-groups.scss +33 -25
- data/assets/bower_components/foundation/scss/foundation/components/_buttons.scss +30 -28
- data/assets/bower_components/foundation/scss/foundation/components/_clearing.scss +51 -47
- data/assets/bower_components/foundation/scss/foundation/components/_dropdown-buttons.scss +10 -11
- data/assets/bower_components/foundation/scss/foundation/components/_dropdown.scss +45 -38
- data/assets/bower_components/foundation/scss/foundation/components/_flex-video.scss +7 -7
- data/assets/bower_components/foundation/scss/foundation/components/_forms.scss +99 -62
- data/assets/bower_components/foundation/scss/foundation/components/_global.scss +152 -67
- data/assets/bower_components/foundation/scss/foundation/components/_grid.scss +39 -36
- data/assets/bower_components/foundation/scss/foundation/components/_icon-bar.scss +337 -235
- data/assets/bower_components/foundation/scss/foundation/components/_inline-lists.scss +9 -8
- data/assets/bower_components/foundation/scss/foundation/components/_joyride.scss +40 -42
- data/assets/bower_components/foundation/scss/foundation/components/_keystrokes.scss +2 -3
- data/assets/bower_components/foundation/scss/foundation/components/_labels.scss +6 -6
- data/assets/bower_components/foundation/scss/foundation/components/_magellan.scss +2 -2
- data/assets/bower_components/foundation/scss/foundation/components/_offcanvas.scss +259 -168
- data/assets/bower_components/foundation/scss/foundation/components/_orbit.scss +82 -62
- data/assets/bower_components/foundation/scss/foundation/components/_pagination.scss +16 -15
- data/assets/bower_components/foundation/scss/foundation/components/_panels.scss +21 -15
- data/assets/bower_components/foundation/scss/foundation/components/_pricing-tables.scss +16 -16
- data/assets/bower_components/foundation/scss/foundation/components/_progress-bars.scss +10 -4
- data/assets/bower_components/foundation/scss/foundation/components/_range-slider.scss +28 -20
- data/assets/bower_components/foundation/scss/foundation/components/_reveal.scss +38 -28
- data/assets/bower_components/foundation/scss/foundation/components/_side-nav.scss +15 -11
- data/assets/bower_components/foundation/scss/foundation/components/_split-buttons.scss +22 -18
- data/assets/bower_components/foundation/scss/foundation/components/_sub-nav.scss +14 -12
- data/assets/bower_components/foundation/scss/foundation/components/_switches.scss +22 -19
- data/assets/bower_components/foundation/scss/foundation/components/_tables.scss +8 -8
- data/assets/bower_components/foundation/scss/foundation/components/_tabs.scss +50 -31
- data/assets/bower_components/foundation/scss/foundation/components/_thumbs.scss +8 -8
- data/assets/bower_components/foundation/scss/foundation/components/_tooltips.scss +25 -25
- data/assets/bower_components/foundation/scss/foundation/components/_top-bar.scss +176 -122
- data/assets/bower_components/foundation/scss/foundation/components/_type.scss +38 -38
- data/assets/bower_components/foundation/scss/foundation/components/_visibility.scss +33 -16
- data/assets/bower_components/foundation/scss/foundation.scss +37 -40
- data/assets/bower_components/foundation/scss/normalize.scss +8 -11
- data/assets/bower_components/jquery/bower.json +2 -1
- data/assets/bower_components/jquery/dist/jquery.js +9 -4
- data/assets/bower_components/jquery/dist/jquery.min.js +4 -4
- data/assets/bower_components/jquery/dist/jquery.min.map +1 -1
- data/assets/bower_components/jquery/src/core.js +6 -1
- data/assets/scss/_settings.scss +2 -0
- data/assets/stylesheets/app.css +3066 -2429
- data/lib/catscope/version.rb +1 -1
- data/lib/catscope/views/layout.erb +6 -2
- metadata +8 -4
- data/assets/bower_components/foundation/scss/foundation/components/_toolbar.scss +0 -70
@@ -4,14 +4,16 @@
|
|
4
4
|
Foundation.libs.clearing = {
|
5
5
|
name : 'clearing',
|
6
6
|
|
7
|
-
version: '5.5.
|
7
|
+
version : '5.5.3',
|
8
8
|
|
9
9
|
settings : {
|
10
10
|
templates : {
|
11
11
|
viewing : '<a href="#" class="clearing-close">×</a>' +
|
12
12
|
'<div class="visible-img" style="display: none"><div class="clearing-touch-label"></div><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' +
|
13
13
|
'<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
|
14
|
-
'<a href="#" class="clearing-main-next"><span></span></a></div>'
|
14
|
+
'<a href="#" class="clearing-main-next"><span></span></a></div>' +
|
15
|
+
'<img class="clearing-preload-next" style="display: none" src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' +
|
16
|
+
'<img class="clearing-preload-prev" style="display: none" src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />'
|
15
17
|
},
|
16
18
|
|
17
19
|
// comma delimited list of selectors that, on click, will close clearing,
|
@@ -26,7 +28,7 @@
|
|
26
28
|
|
27
29
|
touch_label : '',
|
28
30
|
|
29
|
-
// event
|
31
|
+
// event initializer and locks
|
30
32
|
init : false,
|
31
33
|
locked : false
|
32
34
|
},
|
@@ -107,23 +109,27 @@
|
|
107
109
|
S = self.S;
|
108
110
|
|
109
111
|
S(this.scope)
|
110
|
-
.on('touchstart.fndtn.clearing', '.visible-img', function(e) {
|
112
|
+
.on('touchstart.fndtn.clearing', '.visible-img', function (e) {
|
111
113
|
if (!e.touches) { e = e.originalEvent; }
|
112
114
|
var data = {
|
113
|
-
start_page_x: e.touches[0].pageX,
|
114
|
-
start_page_y: e.touches[0].pageY,
|
115
|
-
start_time: (new Date()).getTime(),
|
116
|
-
delta_x: 0,
|
117
|
-
is_scrolling: undefined
|
115
|
+
start_page_x : e.touches[0].pageX,
|
116
|
+
start_page_y : e.touches[0].pageY,
|
117
|
+
start_time : (new Date()).getTime(),
|
118
|
+
delta_x : 0,
|
119
|
+
is_scrolling : undefined
|
118
120
|
};
|
119
121
|
|
120
122
|
S(this).data('swipe-transition', data);
|
121
123
|
e.stopPropagation();
|
122
124
|
})
|
123
|
-
.on('touchmove.fndtn.clearing', '.visible-img', function(e) {
|
124
|
-
if (!e.touches) {
|
125
|
+
.on('touchmove.fndtn.clearing', '.visible-img', function (e) {
|
126
|
+
if (!e.touches) {
|
127
|
+
e = e.originalEvent;
|
128
|
+
}
|
125
129
|
// Ignore pinch/zoom events
|
126
|
-
if(e.touches.length > 1 || e.scale && e.scale !== 1)
|
130
|
+
if (e.touches.length > 1 || e.scale && e.scale !== 1) {
|
131
|
+
return;
|
132
|
+
}
|
127
133
|
|
128
134
|
var data = S(this).data('swipe-transition');
|
129
135
|
|
@@ -148,7 +154,7 @@
|
|
148
154
|
self.nav(e, direction);
|
149
155
|
}
|
150
156
|
})
|
151
|
-
.on('touchend.fndtn.clearing', '.visible-img', function(e) {
|
157
|
+
.on('touchend.fndtn.clearing', '.visible-img', function (e) {
|
152
158
|
S(this).data('swipe-transition', {});
|
153
159
|
e.stopPropagation();
|
154
160
|
});
|
@@ -175,8 +181,8 @@
|
|
175
181
|
var holder = this.S('#foundationClearingHolder'),
|
176
182
|
settings = $el.data(this.attr_name(true) + '-init'),
|
177
183
|
data = {
|
178
|
-
grid: '<div class="carousel">' + grid_outerHTML + '</div>',
|
179
|
-
viewing: settings.templates.viewing
|
184
|
+
grid : '<div class="carousel">' + grid_outerHTML + '</div>',
|
185
|
+
viewing : settings.templates.viewing
|
180
186
|
},
|
181
187
|
wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
|
182
188
|
data.grid + '</div></div>',
|
@@ -197,10 +203,11 @@
|
|
197
203
|
visible_image = self.S('.visible-img', container),
|
198
204
|
image = self.S('img', visible_image).not($image),
|
199
205
|
label = self.S('.clearing-touch-label', container),
|
200
|
-
error = false
|
206
|
+
error = false,
|
207
|
+
loaded = {};
|
201
208
|
|
202
209
|
// Event to disable scrolling on touch devices when Clearing is activated
|
203
|
-
$('body').on('touchmove',function(e){
|
210
|
+
$('body').on('touchmove', function (e) {
|
204
211
|
e.preventDefault();
|
205
212
|
});
|
206
213
|
|
@@ -223,6 +230,7 @@
|
|
223
230
|
function cb (image) {
|
224
231
|
var $image = $(image);
|
225
232
|
$image.css('visibility', 'visible');
|
233
|
+
$image.trigger('imageVisible');
|
226
234
|
// toggle the gallery
|
227
235
|
body.css('overflow', 'hidden');
|
228
236
|
root.addClass('clearing-blackout');
|
@@ -241,9 +249,17 @@
|
|
241
249
|
if (!this.locked()) {
|
242
250
|
visible_image.trigger('open.fndtn.clearing');
|
243
251
|
// set the image to the selected thumbnail
|
244
|
-
image
|
245
|
-
|
246
|
-
|
252
|
+
loaded = this.load($image);
|
253
|
+
if (loaded.interchange) {
|
254
|
+
image
|
255
|
+
.attr('data-interchange', loaded.interchange)
|
256
|
+
.foundation('interchange', 'reflow');
|
257
|
+
} else {
|
258
|
+
image
|
259
|
+
.attr('src', loaded.src)
|
260
|
+
.attr('data-interchange', '');
|
261
|
+
}
|
262
|
+
image.css('visibility', 'hidden');
|
247
263
|
|
248
264
|
startLoad.call(this);
|
249
265
|
}
|
@@ -291,9 +307,15 @@
|
|
291
307
|
PREV_KEY = this.rtl ? 39 : 37,
|
292
308
|
ESC_KEY = 27;
|
293
309
|
|
294
|
-
if (e.which === NEXT_KEY)
|
295
|
-
|
296
|
-
|
310
|
+
if (e.which === NEXT_KEY) {
|
311
|
+
this.go(clearing, 'next');
|
312
|
+
}
|
313
|
+
if (e.which === PREV_KEY) {
|
314
|
+
this.go(clearing, 'prev');
|
315
|
+
}
|
316
|
+
if (e.which === ESC_KEY) {
|
317
|
+
this.S('a.clearing-close').trigger('click.fndtn.clearing');
|
318
|
+
}
|
297
319
|
},
|
298
320
|
|
299
321
|
nav : function (e, direction) {
|
@@ -371,35 +393,55 @@
|
|
371
393
|
// image loading and preloading
|
372
394
|
|
373
395
|
load : function ($image) {
|
374
|
-
var href
|
396
|
+
var href,
|
397
|
+
interchange,
|
398
|
+
closest_a;
|
375
399
|
|
376
400
|
if ($image[0].nodeName === 'A') {
|
377
401
|
href = $image.attr('href');
|
402
|
+
interchange = $image.data('clearing-interchange');
|
378
403
|
} else {
|
379
|
-
|
404
|
+
closest_a = $image.closest('a');
|
405
|
+
href = closest_a.attr('href');
|
406
|
+
interchange = closest_a.data('clearing-interchange');
|
380
407
|
}
|
381
408
|
|
382
409
|
this.preload($image);
|
383
410
|
|
384
|
-
|
385
|
-
|
411
|
+
return {
|
412
|
+
'src': href ? href : $image.attr('src'),
|
413
|
+
'interchange': href ? interchange : $image.data('clearing-interchange')
|
414
|
+
}
|
386
415
|
},
|
387
416
|
|
388
417
|
preload : function ($image) {
|
389
418
|
this
|
390
|
-
.img($image.closest('li').next())
|
391
|
-
.img($image.closest('li').prev());
|
419
|
+
.img($image.closest('li').next(), 'next')
|
420
|
+
.img($image.closest('li').prev(), 'prev');
|
392
421
|
},
|
393
422
|
|
394
|
-
img : function (img) {
|
423
|
+
img : function (img, sibling_type) {
|
395
424
|
if (img.length) {
|
396
|
-
var
|
397
|
-
new_a = this.S('a', img)
|
425
|
+
var preload_img = $('.clearing-preload-' + sibling_type),
|
426
|
+
new_a = this.S('a', img),
|
427
|
+
src,
|
428
|
+
interchange,
|
429
|
+
image;
|
398
430
|
|
399
431
|
if (new_a.length) {
|
400
|
-
|
432
|
+
src = new_a.attr('href');
|
433
|
+
interchange = new_a.data('clearing-interchange');
|
401
434
|
} else {
|
402
|
-
|
435
|
+
image = this.S('img', img);
|
436
|
+
src = image.attr('src');
|
437
|
+
interchange = image.data('clearing-interchange');
|
438
|
+
}
|
439
|
+
|
440
|
+
if (interchange) {
|
441
|
+
preload_img.attr('data-interchange', interchange);
|
442
|
+
} else {
|
443
|
+
preload_img.attr('src', src);
|
444
|
+
preload_img.attr('data-interchange', '');
|
403
445
|
}
|
404
446
|
}
|
405
447
|
return this;
|
@@ -411,9 +453,9 @@
|
|
411
453
|
var caption = $image.attr('data-caption');
|
412
454
|
|
413
455
|
if (caption) {
|
414
|
-
|
415
|
-
|
416
|
-
|
456
|
+
var containerPlain = container.get(0);
|
457
|
+
containerPlain.innerHTML = caption;
|
458
|
+
container.show();
|
417
459
|
} else {
|
418
460
|
container
|
419
461
|
.text('')
|
@@ -435,7 +477,7 @@
|
|
435
477
|
|
436
478
|
if (target.length) {
|
437
479
|
this.S('img', target)
|
438
|
-
.trigger('click
|
480
|
+
.trigger('click.fndtn.clearing', [current, target])
|
439
481
|
.trigger('change.fndtn.clearing');
|
440
482
|
}
|
441
483
|
},
|
@@ -454,7 +496,7 @@
|
|
454
496
|
// we use jQuery animate instead of CSS transitions because we
|
455
497
|
// need a callback to unlock the next animation
|
456
498
|
// needs support for RTL **
|
457
|
-
if (target.index() !== old_index && !/skip/.test(direction)){
|
499
|
+
if (target.index() !== old_index && !/skip/.test(direction)) {
|
458
500
|
if (/left/.test(direction)) {
|
459
501
|
this.lock();
|
460
502
|
dir_obj[dir] = left + width;
|
@@ -510,7 +552,9 @@
|
|
510
552
|
|
511
553
|
adjacent : function (current_index, target_index) {
|
512
554
|
for (var i = target_index + 1; i >= target_index - 1; i--) {
|
513
|
-
if (i === current_index)
|
555
|
+
if (i === current_index) {
|
556
|
+
return true;
|
557
|
+
}
|
514
558
|
}
|
515
559
|
return false;
|
516
560
|
},
|
@@ -4,17 +4,17 @@
|
|
4
4
|
Foundation.libs.dropdown = {
|
5
5
|
name : 'dropdown',
|
6
6
|
|
7
|
-
version : '5.5.
|
7
|
+
version : '5.5.3',
|
8
8
|
|
9
9
|
settings : {
|
10
|
-
active_class: 'open',
|
11
|
-
disabled_class: 'disabled',
|
12
|
-
mega_class: 'mega',
|
13
|
-
align: 'bottom',
|
14
|
-
is_hover: false,
|
15
|
-
hover_timeout: 150,
|
16
|
-
opened: function(){},
|
17
|
-
closed: function(){}
|
10
|
+
active_class : 'open',
|
11
|
+
disabled_class : 'disabled',
|
12
|
+
mega_class : 'mega',
|
13
|
+
align : 'bottom',
|
14
|
+
is_hover : false,
|
15
|
+
hover_timeout : 150,
|
16
|
+
opened : function () {},
|
17
|
+
closed : function () {}
|
18
18
|
},
|
19
19
|
|
20
20
|
init : function (scope, method, options) {
|
@@ -34,7 +34,7 @@
|
|
34
34
|
var settings = S(this).data(self.attr_name(true) + '-init') || self.settings;
|
35
35
|
if (!settings.is_hover || Modernizr.touch) {
|
36
36
|
e.preventDefault();
|
37
|
-
if (S(this).parent('[data-reveal-id]')) {
|
37
|
+
if (S(this).parent('[data-reveal-id]').length) {
|
38
38
|
e.stopPropagation();
|
39
39
|
}
|
40
40
|
self.toggle($(this));
|
@@ -57,11 +57,13 @@
|
|
57
57
|
|
58
58
|
var settings = target.data(self.attr_name(true) + '-init') || self.settings;
|
59
59
|
|
60
|
-
if(S(e.currentTarget).data(self.data_attr()) && settings.is_hover) {
|
60
|
+
if (S(e.currentTarget).data(self.data_attr()) && settings.is_hover) {
|
61
61
|
self.closeall.call(self);
|
62
62
|
}
|
63
63
|
|
64
|
-
if (settings.is_hover)
|
64
|
+
if (settings.is_hover) {
|
65
|
+
self.open.apply(self, [dropdown, target]);
|
66
|
+
}
|
65
67
|
})
|
66
68
|
.on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
|
67
69
|
var $this = S(this);
|
@@ -69,17 +71,20 @@
|
|
69
71
|
|
70
72
|
if ($this.data(self.data_attr())) {
|
71
73
|
settings = $this.data(self.data_attr(true) + '-init') || self.settings;
|
72
|
-
}
|
73
|
-
else {
|
74
|
+
} else {
|
74
75
|
var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
|
75
76
|
settings = target.data(self.attr_name(true) + '-init') || self.settings;
|
76
77
|
}
|
77
78
|
|
78
79
|
self.timeout = setTimeout(function () {
|
79
80
|
if ($this.data(self.data_attr())) {
|
80
|
-
if (settings.is_hover)
|
81
|
+
if (settings.is_hover) {
|
82
|
+
self.close.call(self, S('#' + $this.data(self.data_attr())));
|
83
|
+
}
|
81
84
|
} else {
|
82
|
-
if (settings.is_hover)
|
85
|
+
if (settings.is_hover) {
|
86
|
+
self.close.call(self, $this);
|
87
|
+
}
|
83
88
|
}
|
84
89
|
}.bind(this), settings.hover_timeout);
|
85
90
|
})
|
@@ -87,7 +92,7 @@
|
|
87
92
|
var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
|
88
93
|
var links = parent.find('a');
|
89
94
|
|
90
|
-
if (links.length > 0 && parent.attr('aria-autoclose') !==
|
95
|
+
if (links.length > 0 && parent.attr('aria-autoclose') !== 'false') {
|
91
96
|
self.close.call(self, S('[' + self.attr_name() + '-content]'));
|
92
97
|
}
|
93
98
|
|
@@ -124,46 +129,46 @@
|
|
124
129
|
this.resize();
|
125
130
|
},
|
126
131
|
|
127
|
-
close: function (dropdown) {
|
132
|
+
close : function (dropdown) {
|
128
133
|
var self = this;
|
129
|
-
dropdown.each(function () {
|
130
|
-
var original_target = $('[' + self.attr_name() + '=' + dropdown[
|
134
|
+
dropdown.each(function (idx) {
|
135
|
+
var original_target = $('[' + self.attr_name() + '=' + dropdown[idx].id + ']') || $('aria-controls=' + dropdown[idx].id + ']');
|
131
136
|
original_target.attr('aria-expanded', 'false');
|
132
137
|
if (self.S(this).hasClass(self.settings.active_class)) {
|
133
138
|
self.S(this)
|
134
|
-
.css(Foundation.rtl ? 'right':'left', '-99999px')
|
139
|
+
.css(Foundation.rtl ? 'right' : 'left', '-99999px')
|
135
140
|
.attr('aria-hidden', 'true')
|
136
141
|
.removeClass(self.settings.active_class)
|
137
142
|
.prev('[' + self.attr_name() + ']')
|
138
143
|
.removeClass(self.settings.active_class)
|
139
144
|
.removeData('target');
|
140
145
|
|
141
|
-
self.S(this).trigger('closed
|
146
|
+
self.S(this).trigger('closed.fndtn.dropdown', [dropdown]);
|
142
147
|
}
|
143
148
|
});
|
144
149
|
dropdown.removeClass('f-open-' + this.attr_name(true));
|
145
150
|
},
|
146
151
|
|
147
|
-
closeall: function() {
|
152
|
+
closeall : function () {
|
148
153
|
var self = this;
|
149
|
-
$.each(self.S('.f-open-' + this.attr_name(true)), function() {
|
154
|
+
$.each(self.S('.f-open-' + this.attr_name(true)), function () {
|
150
155
|
self.close.call(self, self.S(this));
|
151
156
|
});
|
152
157
|
},
|
153
158
|
|
154
|
-
open: function (dropdown, target) {
|
159
|
+
open : function (dropdown, target) {
|
155
160
|
this
|
156
161
|
.css(dropdown
|
157
162
|
.addClass(this.settings.active_class), target);
|
158
163
|
dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class);
|
159
|
-
dropdown.data('target', target.get(0)).trigger('opened
|
164
|
+
dropdown.data('target', target.get(0)).trigger('opened.fndtn.dropdown', [dropdown, target]);
|
160
165
|
dropdown.attr('aria-hidden', 'false');
|
161
166
|
target.attr('aria-expanded', 'true');
|
162
167
|
dropdown.focus();
|
163
168
|
dropdown.addClass('f-open-' + this.attr_name(true));
|
164
169
|
},
|
165
170
|
|
166
|
-
data_attr: function () {
|
171
|
+
data_attr : function () {
|
167
172
|
if (this.namespace.length > 0) {
|
168
173
|
return this.namespace + '-' + this.name;
|
169
174
|
}
|
@@ -185,16 +190,17 @@
|
|
185
190
|
|
186
191
|
if (dropdown.hasClass(this.settings.active_class)) {
|
187
192
|
this.close.call(this, dropdown);
|
188
|
-
if (dropdown.data('target') !== target.get(0))
|
193
|
+
if (dropdown.data('target') !== target.get(0)) {
|
189
194
|
this.open.call(this, dropdown, target);
|
195
|
+
}
|
190
196
|
} else {
|
191
197
|
this.open.call(this, dropdown, target);
|
192
198
|
}
|
193
199
|
},
|
194
200
|
|
195
201
|
resize : function () {
|
196
|
-
var dropdown = this.S('[' + this.attr_name() + '-content].open')
|
197
|
-
|
202
|
+
var dropdown = this.S('[' + this.attr_name() + '-content].open');
|
203
|
+
var target = $(dropdown.data("target"));
|
198
204
|
|
199
205
|
if (dropdown.length && target.length) {
|
200
206
|
this.css(dropdown, target);
|
@@ -203,22 +209,37 @@
|
|
203
209
|
|
204
210
|
css : function (dropdown, target) {
|
205
211
|
var left_offset = Math.max((target.width() - dropdown.width()) / 2, 8),
|
206
|
-
settings = target.data(this.attr_name(true) + '-init') || this.settings
|
212
|
+
settings = target.data(this.attr_name(true) + '-init') || this.settings,
|
213
|
+
parentOverflow = dropdown.parent().css('overflow-y') || dropdown.parent().css('overflow');
|
207
214
|
|
208
215
|
this.clear_idx();
|
209
216
|
|
217
|
+
|
218
|
+
|
210
219
|
if (this.small()) {
|
211
220
|
var p = this.dirs.bottom.call(dropdown, target, settings);
|
212
221
|
|
213
222
|
dropdown.attr('style', '').removeClass('drop-left drop-right drop-top').css({
|
214
223
|
position : 'absolute',
|
215
|
-
width: '95%',
|
216
|
-
'max-width': 'none',
|
217
|
-
top: p.top
|
224
|
+
width : '95%',
|
225
|
+
'max-width' : 'none',
|
226
|
+
top : p.top
|
218
227
|
});
|
219
228
|
|
220
|
-
dropdown.css(Foundation.rtl ? 'right':'left', left_offset);
|
221
|
-
}
|
229
|
+
dropdown.css(Foundation.rtl ? 'right' : 'left', left_offset);
|
230
|
+
}
|
231
|
+
// detect if dropdown is in an overflow container
|
232
|
+
else if (parentOverflow !== 'visible') {
|
233
|
+
var offset = target[0].offsetTop + target[0].offsetHeight;
|
234
|
+
|
235
|
+
dropdown.attr('style', '').css({
|
236
|
+
position : 'absolute',
|
237
|
+
top : offset
|
238
|
+
});
|
239
|
+
|
240
|
+
dropdown.css(Foundation.rtl ? 'right' : 'left', left_offset);
|
241
|
+
}
|
242
|
+
else {
|
222
243
|
|
223
244
|
this.style(dropdown, target, settings);
|
224
245
|
}
|
@@ -227,7 +248,7 @@
|
|
227
248
|
},
|
228
249
|
|
229
250
|
style : function (dropdown, target, settings) {
|
230
|
-
var css = $.extend({position: 'absolute'},
|
251
|
+
var css = $.extend({position : 'absolute'},
|
231
252
|
this.dirs[settings.align].call(dropdown, target, settings));
|
232
253
|
|
233
254
|
dropdown.attr('style', '').css(css);
|
@@ -237,48 +258,53 @@
|
|
237
258
|
// `this` is the dropdown
|
238
259
|
dirs : {
|
239
260
|
// Calculate target offset
|
240
|
-
_base : function (t) {
|
261
|
+
_base : function (t, s) {
|
241
262
|
var o_p = this.offsetParent(),
|
242
263
|
o = o_p.offset(),
|
243
264
|
p = t.offset();
|
244
265
|
|
245
266
|
p.top -= o.top;
|
246
267
|
p.left -= o.left;
|
247
|
-
|
268
|
+
|
248
269
|
//set some flags on the p object to pass along
|
249
270
|
p.missRight = false;
|
250
271
|
p.missTop = false;
|
251
272
|
p.missLeft = false;
|
252
273
|
p.leftRightFlag = false;
|
253
|
-
|
274
|
+
|
254
275
|
//lets see if the panel will be off the screen
|
255
276
|
//get the actual width of the page and store it
|
256
277
|
var actualBodyWidth;
|
278
|
+
var windowWidth = window.innerWidth;
|
279
|
+
|
257
280
|
if (document.getElementsByClassName('row')[0]) {
|
258
281
|
actualBodyWidth = document.getElementsByClassName('row')[0].clientWidth;
|
259
282
|
} else {
|
260
|
-
actualBodyWidth =
|
283
|
+
actualBodyWidth = windowWidth;
|
261
284
|
}
|
262
285
|
|
263
|
-
var actualMarginWidth = (
|
286
|
+
var actualMarginWidth = (windowWidth - actualBodyWidth) / 2;
|
264
287
|
var actualBoundary = actualBodyWidth;
|
265
|
-
|
266
|
-
if (!this.hasClass('mega')) {
|
288
|
+
|
289
|
+
if (!this.hasClass('mega') && !s.ignore_repositioning) {
|
290
|
+
var outerWidth = this.outerWidth();
|
291
|
+
var o_left = t.offset().left;
|
292
|
+
|
267
293
|
//miss top
|
268
294
|
if (t.offset().top <= this.outerHeight()) {
|
269
295
|
p.missTop = true;
|
270
|
-
actualBoundary =
|
296
|
+
actualBoundary = windowWidth - actualMarginWidth;
|
271
297
|
p.leftRightFlag = true;
|
272
298
|
}
|
273
|
-
|
299
|
+
|
274
300
|
//miss right
|
275
|
-
if (
|
301
|
+
if (o_left + outerWidth > o_left + actualMarginWidth && o_left - actualMarginWidth > outerWidth) {
|
276
302
|
p.missRight = true;
|
277
303
|
p.missLeft = false;
|
278
304
|
}
|
279
|
-
|
305
|
+
|
280
306
|
//miss left
|
281
|
-
if (
|
307
|
+
if (o_left - outerWidth <= 0) {
|
282
308
|
p.missLeft = true;
|
283
309
|
p.missRight = false;
|
284
310
|
}
|
@@ -287,71 +313,71 @@
|
|
287
313
|
return p;
|
288
314
|
},
|
289
315
|
|
290
|
-
top: function (t, s) {
|
316
|
+
top : function (t, s) {
|
291
317
|
var self = Foundation.libs.dropdown,
|
292
|
-
p = self.dirs._base.call(this, t);
|
318
|
+
p = self.dirs._base.call(this, t, s);
|
293
319
|
|
294
320
|
this.addClass('drop-top');
|
295
|
-
|
321
|
+
|
296
322
|
if (p.missTop == true) {
|
297
323
|
p.top = p.top + t.outerHeight() + this.outerHeight();
|
298
324
|
this.removeClass('drop-top');
|
299
325
|
}
|
300
|
-
|
326
|
+
|
301
327
|
if (p.missRight == true) {
|
302
328
|
p.left = p.left - this.outerWidth() + t.outerWidth();
|
303
329
|
}
|
304
330
|
|
305
331
|
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
306
|
-
self.adjust_pip(this,t,s,p);
|
332
|
+
self.adjust_pip(this, t, s, p);
|
307
333
|
}
|
308
334
|
|
309
335
|
if (Foundation.rtl) {
|
310
|
-
return {left: p.left - this.outerWidth() + t.outerWidth(),
|
311
|
-
top: p.top - this.outerHeight()};
|
336
|
+
return {left : p.left - this.outerWidth() + t.outerWidth(),
|
337
|
+
top : p.top - this.outerHeight()};
|
312
338
|
}
|
313
339
|
|
314
|
-
return {left: p.left, top: p.top - this.outerHeight()};
|
340
|
+
return {left : p.left, top : p.top - this.outerHeight()};
|
315
341
|
},
|
316
342
|
|
317
|
-
bottom: function (t,s) {
|
343
|
+
bottom : function (t, s) {
|
318
344
|
var self = Foundation.libs.dropdown,
|
319
|
-
p = self.dirs._base.call(this, t);
|
345
|
+
p = self.dirs._base.call(this, t, s);
|
320
346
|
|
321
347
|
if (p.missRight == true) {
|
322
348
|
p.left = p.left - this.outerWidth() + t.outerWidth();
|
323
349
|
}
|
324
350
|
|
325
351
|
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
326
|
-
self.adjust_pip(this,t,s,p);
|
352
|
+
self.adjust_pip(this, t, s, p);
|
327
353
|
}
|
328
354
|
|
329
355
|
if (self.rtl) {
|
330
|
-
return {left: p.left - this.outerWidth() + t.outerWidth(), top: p.top + t.outerHeight()};
|
356
|
+
return {left : p.left - this.outerWidth() + t.outerWidth(), top : p.top + t.outerHeight()};
|
331
357
|
}
|
332
358
|
|
333
|
-
return {left: p.left, top: p.top + t.outerHeight()};
|
359
|
+
return {left : p.left, top : p.top + t.outerHeight()};
|
334
360
|
},
|
335
361
|
|
336
|
-
left: function (t, s) {
|
337
|
-
var p = Foundation.libs.dropdown.dirs._base.call(this, t);
|
362
|
+
left : function (t, s) {
|
363
|
+
var p = Foundation.libs.dropdown.dirs._base.call(this, t, s);
|
338
364
|
|
339
365
|
this.addClass('drop-left');
|
340
|
-
|
366
|
+
|
341
367
|
if (p.missLeft == true) {
|
342
368
|
p.left = p.left + this.outerWidth();
|
343
369
|
p.top = p.top + t.outerHeight();
|
344
370
|
this.removeClass('drop-left');
|
345
371
|
}
|
346
372
|
|
347
|
-
return {left: p.left - this.outerWidth(), top: p.top};
|
373
|
+
return {left : p.left - this.outerWidth(), top : p.top};
|
348
374
|
},
|
349
375
|
|
350
|
-
right: function (t, s) {
|
351
|
-
var p = Foundation.libs.dropdown.dirs._base.call(this, t);
|
376
|
+
right : function (t, s) {
|
377
|
+
var p = Foundation.libs.dropdown.dirs._base.call(this, t, s);
|
352
378
|
|
353
379
|
this.addClass('drop-right');
|
354
|
-
|
380
|
+
|
355
381
|
if (p.missRight == true) {
|
356
382
|
p.left = p.left - this.outerWidth();
|
357
383
|
p.top = p.top + t.outerHeight();
|
@@ -359,26 +385,25 @@
|
|
359
385
|
} else {
|
360
386
|
p.triggeredRight = true;
|
361
387
|
}
|
362
|
-
|
388
|
+
|
363
389
|
var self = Foundation.libs.dropdown;
|
364
390
|
|
365
391
|
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
366
|
-
self.adjust_pip(this,t,s,p);
|
392
|
+
self.adjust_pip(this, t, s, p);
|
367
393
|
}
|
368
394
|
|
369
|
-
return {left: p.left + t.outerWidth(), top: p.top};
|
395
|
+
return {left : p.left + t.outerWidth(), top : p.top};
|
370
396
|
}
|
371
397
|
},
|
372
398
|
|
373
399
|
// Insert rule to style psuedo elements
|
374
|
-
adjust_pip : function (dropdown,target,settings,position) {
|
400
|
+
adjust_pip : function (dropdown, target, settings, position) {
|
375
401
|
var sheet = Foundation.stylesheet,
|
376
402
|
pip_offset_base = 8;
|
377
403
|
|
378
404
|
if (dropdown.hasClass(settings.mega_class)) {
|
379
|
-
pip_offset_base = position.left + (target.outerWidth()/2) - 8;
|
380
|
-
}
|
381
|
-
else if (this.small()) {
|
405
|
+
pip_offset_base = position.left + (target.outerWidth() / 2) - 8;
|
406
|
+
} else if (this.small()) {
|
382
407
|
pip_offset_base += position.left - 8;
|
383
408
|
}
|
384
409
|
|
@@ -389,7 +414,7 @@
|
|
389
414
|
sel_after = '.f-dropdown.open:after',
|
390
415
|
css_before = 'left: ' + pip_offset_base + 'px;',
|
391
416
|
css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
|
392
|
-
|
417
|
+
|
393
418
|
if (position.missRight == true) {
|
394
419
|
pip_offset_base = dropdown.outerWidth() - 23;
|
395
420
|
sel_before = '.f-dropdown.open:before',
|
@@ -397,7 +422,7 @@
|
|
397
422
|
css_before = 'left: ' + pip_offset_base + 'px;',
|
398
423
|
css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
|
399
424
|
}
|
400
|
-
|
425
|
+
|
401
426
|
//just a case where right is fired, but its not missing right
|
402
427
|
if (position.triggeredRight == true) {
|
403
428
|
sel_before = '.f-dropdown.open:before',
|
@@ -431,7 +456,7 @@
|
|
431
456
|
!matchMedia(Foundation.media_queries.medium).matches;
|
432
457
|
},
|
433
458
|
|
434
|
-
off: function () {
|
459
|
+
off : function () {
|
435
460
|
this.S(this.scope).off('.fndtn.dropdown');
|
436
461
|
this.S('html, body').off('.fndtn.dropdown');
|
437
462
|
this.S(window).off('.fndtn.dropdown');
|