').addClass(settings.timer_progress_class));
timer_container.addClass(settings.timer_paused_class);
container.append(timer_container);
}
if (settings.slide_number) {
number_container = $('
').addClass(settings.slide_number_class);
number_container.append('
' + settings.slide_number_text + '
');
container.append(number_container);
}
if (settings.bullets) {
bullets_container = $('
').addClass(settings.bullets_container_class);
container.append(bullets_container);
bullets_container.wrap('');
slides_container.children().each(function(idx, el) {
var bullet = $('- ').attr('data-orbit-slide', idx);
bullets_container.append(bullet);
});
}
if (settings.stack_on_small) {
container.addClass(settings.stack_on_small_class);
}
self.update_slide_number(0);
self.update_active_link(0);
};
self._goto = function(next_idx, start_timer) {
// if (locked) {return false;}
if (next_idx === idx) {return false;}
if (typeof timer === 'object') {timer.restart();}
var slides = slides_container.children();
var dir = 'next';
locked = true;
if (next_idx < idx) {dir = 'prev';}
if (next_idx >= slides.length) {
if (!settings.circular) return false;
next_idx = 0;
} else if (next_idx < 0) {
if (!settings.circular) return false;
next_idx = slides.length - 1;
}
var current = $(slides.get(idx));
var next = $(slides.get(next_idx));
current.css('zIndex', 2);
current.removeClass(settings.active_slide_class);
next.css('zIndex', 4).addClass(settings.active_slide_class);
slides_container.trigger('before-slide-change.fndtn.orbit');
settings.before_slide_change();
self.update_active_link(next_idx);
var callback = function() {
var unlock = function() {
idx = next_idx;
locked = false;
if (start_timer === true) {timer = self.create_timer(); timer.start();}
self.update_slide_number(idx);
slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);
settings.after_slide_change(idx, slides.length);
};
if (slides_container.height() != next.height() && settings.variable_height) {
slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
} else {
unlock();
}
};
if (slides.length === 1) {callback(); return false;}
var start_animation = function() {
if (dir === 'next') {animate.next(current, next, callback);}
if (dir === 'prev') {animate.prev(current, next, callback);}
};
if (next.height() > slides_container.height() && settings.variable_height) {
slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
} else {
start_animation();
}
};
self.next = function(e) {
e.stopImmediatePropagation();
e.preventDefault();
self._goto(idx + 1);
};
self.prev = function(e) {
e.stopImmediatePropagation();
e.preventDefault();
self._goto(idx - 1);
};
self.link_custom = function(e) {
e.preventDefault();
var link = $(this).attr('data-orbit-link');
if ((typeof link === 'string') && (link = $.trim(link)) != "") {
var slide = container.find('[data-orbit-slide='+link+']');
if (slide.index() != -1) {self._goto(slide.index());}
}
};
self.link_bullet = function(e) {
var index = $(this).attr('data-orbit-slide');
if ((typeof index === 'string') && (index = $.trim(index)) != "") {
if(isNaN(parseInt(index)))
{
var slide = container.find('[data-orbit-slide='+index+']');
if (slide.index() != -1) {self._goto(slide.index() + 1);}
}
else
{
self._goto(parseInt(index));
}
}
}
self.timer_callback = function() {
self._goto(idx + 1, true);
}
self.compute_dimensions = function() {
var current = $(slides_container.children().get(idx));
var h = current.height();
if (!settings.variable_height) {
slides_container.children().each(function(){
if ($(this).height() > h) { h = $(this).height(); }
});
}
slides_container.height(h);
};
self.create_timer = function() {
var t = new Timer(
container.find('.'+settings.timer_container_class),
settings,
self.timer_callback
);
return t;
};
self.stop_timer = function() {
if (typeof timer === 'object') timer.stop();
};
self.toggle_timer = function() {
var t = container.find('.'+settings.timer_container_class);
if (t.hasClass(settings.timer_paused_class)) {
if (typeof timer === 'undefined') {timer = self.create_timer();}
timer.start();
}
else {
if (typeof timer === 'object') {timer.stop();}
}
};
self.init = function() {
self.build_markup();
if (settings.timer) {timer = self.create_timer(); timer.start();}
animate = new FadeAnimation(settings, slides_container);
if (settings.animation === 'slide')
animate = new SlideAnimation(settings, slides_container);
container.on('click', '.'+settings.next_class, self.next);
container.on('click', '.'+settings.prev_class, self.prev);
container.on('click', '[data-orbit-slide]', self.link_bullet);
container.on('click', self.toggle_timer);
if (settings.swipe) {
container.on('touchstart.fndtn.orbit', function(e) {
if (!e.touches) {e = e.originalEvent;}
var data = {
start_page_x: e.touches[0].pageX,
start_page_y: e.touches[0].pageY,
start_time: (new Date()).getTime(),
delta_x: 0,
is_scrolling: undefined
};
container.data('swipe-transition', data);
e.stopPropagation();
})
.on('touchmove.fndtn.orbit', function(e) {
if (!e.touches) { e = e.originalEvent; }
// Ignore pinch/zoom events
if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
var data = container.data('swipe-transition');
if (typeof data === 'undefined') {data = {};}
data.delta_x = e.touches[0].pageX - data.start_page_x;
if ( typeof data.is_scrolling === 'undefined') {
data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
}
if (!data.is_scrolling && !data.active) {
e.preventDefault();
var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
data.active = true;
self._goto(direction);
}
})
.on('touchend.fndtn.orbit', function(e) {
container.data('swipe-transition', {});
e.stopPropagation();
})
}
container.on('mouseenter.fndtn.orbit', function(e) {
if (settings.timer && settings.pause_on_hover) {
self.stop_timer();
}
})
.on('mouseleave.fndtn.orbit', function(e) {
if (settings.timer && settings.resume_on_mouseout) {
timer.start();
}
});
$(document).on('click', '[data-orbit-link]', self.link_custom);
$(window).on('resize', self.compute_dimensions);
$(window).on('load', self.compute_dimensions);
$(window).on('load', function(){
container.prev('.preloader').css('display', 'none');
});
slides_container.trigger('ready.fndtn.orbit');
};
self.init();
};
var Timer = function(el, settings, callback) {
var self = this,
duration = settings.timer_speed,
progress = el.find('.'+settings.timer_progress_class),
start,
timeout,
left = -1;
this.update_progress = function(w) {
var new_progress = progress.clone();
new_progress.attr('style', '');
new_progress.css('width', w+'%');
progress.replaceWith(new_progress);
progress = new_progress;
};
this.restart = function() {
clearTimeout(timeout);
el.addClass(settings.timer_paused_class);
left = -1;
self.update_progress(0);
};
this.start = function() {
if (!el.hasClass(settings.timer_paused_class)) {return true;}
left = (left === -1) ? duration : left;
el.removeClass(settings.timer_paused_class);
start = new Date().getTime();
progress.animate({'width': '100%'}, left, 'linear');
timeout = setTimeout(function() {
self.restart();
callback();
}, left);
el.trigger('timer-started.fndtn.orbit')
};
this.stop = function() {
if (el.hasClass(settings.timer_paused_class)) {return true;}
clearTimeout(timeout);
el.addClass(settings.timer_paused_class);
var end = new Date().getTime();
left = left - (end - start);
var w = 100 - ((left / duration) * 100);
self.update_progress(w);
el.trigger('timer-stopped.fndtn.orbit');
};
};
var SlideAnimation = function(settings, container) {
var duration = settings.animation_speed;
var is_rtl = ($('html[dir=rtl]').length === 1);
var margin = is_rtl ? 'marginRight' : 'marginLeft';
var animMargin = {};
animMargin[margin] = '0%';
this.next = function(current, next, callback) {
current.animate({marginLeft:'-100%'}, duration);
next.animate(animMargin, duration, function() {
current.css(margin, '100%');
callback();
});
};
this.prev = function(current, prev, callback) {
current.animate({marginLeft:'100%'}, duration);
prev.css(margin, '-100%');
prev.animate(animMargin, duration, function() {
current.css(margin, '100%');
callback();
});
};
};
var FadeAnimation = function(settings, container) {
var duration = settings.animation_speed;
var is_rtl = ($('html[dir=rtl]').length === 1);
var margin = is_rtl ? 'marginRight' : 'marginLeft';
this.next = function(current, next, callback) {
next.css({'margin':'0%', 'opacity':'0.01'});
next.animate({'opacity':'1'}, duration, 'linear', function() {
current.css('margin', '100%');
callback();
});
};
this.prev = function(current, prev, callback) {
prev.css({'margin':'0%', 'opacity':'0.01'});
prev.animate({'opacity':'1'}, duration, 'linear', function() {
current.css('margin', '100%');
callback();
});
};
};
Foundation.libs = Foundation.libs || {};
Foundation.libs.orbit = {
name: 'orbit',
version: '5.0.3',
settings: {
animation: 'slide',
timer_speed: 10000,
pause_on_hover: true,
resume_on_mouseout: false,
animation_speed: 500,
stack_on_small: false,
navigation_arrows: true,
slide_number: true,
slide_number_text: 'of',
container_class: 'orbit-container',
stack_on_small_class: 'orbit-stack-on-small',
next_class: 'orbit-next',
prev_class: 'orbit-prev',
timer_container_class: 'orbit-timer',
timer_paused_class: 'paused',
timer_progress_class: 'orbit-progress',
slides_container_class: 'orbit-slides-container',
bullets_container_class: 'orbit-bullets',
bullets_active_class: 'active',
slide_number_class: 'orbit-slide-number',
caption_class: 'orbit-caption',
active_slide_class: 'active',
orbit_transition_class: 'orbit-transitioning',
bullets: true,
circular: true,
timer: true,
variable_height: false,
swipe: true,
before_slide_change: noop,
after_slide_change: noop
},
init : function (scope, method, options) {
var self = this;
this.bindings(method, options);
},
events : function (instance) {
var orbit_instance = new Orbit($(instance), $(instance).data('orbit-init'));
$(instance).data(self.name + '-instance', orbit_instance);
},
reflow : function () {
var self = this;
if ($(self.scope).is('[data-orbit]')) {
var $el = $(self.scope);
var instance = $el.data(self.name + '-instance');
instance.compute_dimensions();
} else {
$('[data-orbit]', self.scope).each(function(idx, el) {
var $el = $(el);
var opts = self.data_options($el);
var instance = $el.data(self.name + '-instance');
instance.compute_dimensions();
});
}
}
};
}(jQuery, this, this.document));
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.reveal = {
name : 'reveal',
version : '5.0.3',
locked : false,
settings : {
animation: 'fadeAndPop',
animation_speed: 250,
close_on_background_click: true,
close_on_esc: true,
dismiss_modal_class: 'close-reveal-modal',
bg_class: 'reveal-modal-bg',
open: function(){},
opened: function(){},
close: function(){},
closed: function(){},
bg : $('.reveal-modal-bg'),
css : {
open : {
'opacity': 0,
'visibility': 'visible',
'display' : 'block'
},
close : {
'opacity': 1,
'visibility': 'hidden',
'display': 'none'
}
}
},
init : function (scope, method, options) {
Foundation.inherit(this, 'delay');
$.extend(true, this.settings, method, options);
this.bindings(method, options);
},
events : function (scope) {
var self = this;
$('[data-reveal-id]', this.scope)
.off('.reveal')
.on('click.fndtn.reveal', function (e) {
e.preventDefault();
if (!self.locked) {
var element = $(this),
ajax = element.data('reveal-ajax');
self.locked = true;
if (typeof ajax === 'undefined') {
self.open.call(self, element);
} else {
var url = ajax === true ? element.attr('href') : ajax;
self.open.call(self, element, {url: url});
}
}
});
$(this.scope)
.off('.reveal');
$(document)
.on('click.fndtn.reveal', this.close_targets(), function (e) {
e.preventDefault();
if (!self.locked) {
var settings = $('[data-reveal].open').data('reveal-init'),
bg_clicked = $(e.target)[0] === $('.' + settings.bg_class)[0];
if (bg_clicked && !settings.close_on_background_click) {
return;
}
self.locked = true;
self.close.call(self, bg_clicked ? $('[data-reveal].open') : $(this).closest('[data-reveal]'));
}
});
if($('[data-reveal]', this.scope).length > 0) {
$(this.scope)
// .off('.reveal')
.on('open.fndtn.reveal', this.settings.open)
.on('opened.fndtn.reveal', this.settings.opened)
.on('opened.fndtn.reveal', this.open_video)
.on('close.fndtn.reveal', this.settings.close)
.on('closed.fndtn.reveal', this.settings.closed)
.on('closed.fndtn.reveal', this.close_video);
} else {
$(this.scope)
// .off('.reveal')
.on('open.fndtn.reveal', '[data-reveal]', this.settings.open)
.on('opened.fndtn.reveal', '[data-reveal]', this.settings.opened)
.on('opened.fndtn.reveal', '[data-reveal]', this.open_video)
.on('close.fndtn.reveal', '[data-reveal]', this.settings.close)
.on('closed.fndtn.reveal', '[data-reveal]', this.settings.closed)
.on('closed.fndtn.reveal', '[data-reveal]', this.close_video);
}
return true;
},
// PATCH #3: turning on key up capture only when a reveal window is open
key_up_on : function (scope) {
var self = this;
// PATCH #1: fixing multiple keyup event trigger from single key press
$('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
var open_modal = $('[data-reveal].open'),
settings = open_modal.data('reveal-init');
// PATCH #2: making sure that the close event can be called only while unlocked,
// so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
self.close.call(self, open_modal);
}
});
return true;
},
// PATCH #3: turning on key up capture only when a reveal window is open
key_up_off : function (scope) {
$('body').off('keyup.fndtn.reveal');
return true;
},
open : function (target, ajax_settings) {
var self = this;
if (target) {
if (typeof target.selector !== 'undefined') {
var modal = $('#' + target.data('reveal-id'));
} else {
var modal = $(this.scope);
ajax_settings = target;
}
} else {
var modal = $(this.scope);
}
var settings = modal.data('reveal-init');
if (!modal.hasClass('open')) {
var open_modal = $('[data-reveal].open');
if (typeof modal.data('css-top') === 'undefined') {
modal.data('css-top', parseInt(modal.css('top'), 10))
.data('offset', this.cache_offset(modal));
}
this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
modal.trigger('open');
if (open_modal.length < 1) {
this.toggle_bg(modal);
}
if (typeof ajax_settings === 'string') {
ajax_settings = {
url: ajax_settings
};
}
if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
if (open_modal.length > 0) {
var open_modal_settings = open_modal.data('reveal-init');
this.hide(open_modal, open_modal_settings.css.close);
}
this.show(modal, settings.css.open);
} else {
var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
$.extend(ajax_settings, {
success: function (data, textStatus, jqXHR) {
if ( $.isFunction(old_success) ) {
old_success(data, textStatus, jqXHR);
}
modal.html(data);
$(modal).foundation('section', 'reflow');
if (open_modal.length > 0) {
var open_modal_settings = open_modal.data('reveal-init');
self.hide(open_modal, open_modal_settings.css.close);
}
self.show(modal, settings.css.open);
}
});
$.ajax(ajax_settings);
}
}
},
close : function (modal) {
var modal = modal && modal.length ? modal : $(this.scope),
open_modals = $('[data-reveal].open'),
settings = modal.data('reveal-init');
if (open_modals.length > 0) {
this.locked = true;
this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
modal.trigger('close');
this.toggle_bg(modal);
this.hide(open_modals, settings.css.close, settings);
}
},
close_targets : function () {
var base = '.' + this.settings.dismiss_modal_class;
if (this.settings.close_on_background_click) {
return base + ', .' + this.settings.bg_class;
}
return base;
},
toggle_bg : function (modal) {
var settings = modal.data('reveal-init');
if ($('.' + this.settings.bg_class).length === 0) {
this.settings.bg = $('', {'class': this.settings.bg_class})
.appendTo('body');
}
if (this.settings.bg.filter(':visible').length > 0) {
this.hide(this.settings.bg);
} else {
this.show(this.settings.bg);
}
},
show : function (el, css) {
// is modal
if (css) {
var settings = el.data('reveal-init');
if (el.parent('body').length === 0) {
var placeholder = el.wrap('').parent(),
rootElement = this.settings.rootElement || 'body';;
el.on('closed.fndtn.reveal.wrapped', function() {
el.detach().appendTo(placeholder);
el.unwrap().unbind('closed.fndtn.reveal.wrapped');
});
el.detach().appendTo(rootElement);
}
if (/pop/i.test(settings.animation)) {
css.top = $(window).scrollTop() - el.data('offset') + 'px';
var end_css = {
top: $(window).scrollTop() + el.data('css-top') + 'px',
opacity: 1
};
return this.delay(function () {
return el
.css(css)
.animate(end_css, settings.animation_speed, 'linear', function () {
this.locked = false;
el.trigger('opened');
}.bind(this))
.addClass('open');
}.bind(this), settings.animation_speed / 2);
}
if (/fade/i.test(settings.animation)) {
var end_css = {opacity: 1};
return this.delay(function () {
return el
.css(css)
.animate(end_css, settings.animation_speed, 'linear', function () {
this.locked = false;
el.trigger('opened');
}.bind(this))
.addClass('open');
}.bind(this), settings.animation_speed / 2);
}
return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
}
var settings = this.settings;
// should we animate the background?
if (/fade/i.test(settings.animation)) {
return el.fadeIn(settings.animation_speed / 2);
}
return el.show();
},
hide : function (el, css) {
// is modal
if (css) {
var settings = el.data('reveal-init');
if (/pop/i.test(settings.animation)) {
var end_css = {
top: - $(window).scrollTop() - el.data('offset') + 'px',
opacity: 0
};
return this.delay(function () {
return el
.animate(end_css, settings.animation_speed, 'linear', function () {
this.locked = false;
el.css(css).trigger('closed');
}.bind(this))
.removeClass('open');
}.bind(this), settings.animation_speed / 2);
}
if (/fade/i.test(settings.animation)) {
var end_css = {opacity: 0};
return this.delay(function () {
return el
.animate(end_css, settings.animation_speed, 'linear', function () {
this.locked = false;
el.css(css).trigger('closed');
}.bind(this))
.removeClass('open');
}.bind(this), settings.animation_speed / 2);
}
return el.hide().css(css).removeClass('open').trigger('closed');
}
var settings = this.settings;
// should we animate the background?
if (/fade/i.test(settings.animation)) {
return el.fadeOut(settings.animation_speed / 2);
}
return el.hide();
},
close_video : function (e) {
var video = $(this).find('.flex-video'),
iframe = video.find('iframe');
if (iframe.length > 0) {
iframe.attr('data-src', iframe[0].src);
iframe.attr('src', 'about:blank');
video.hide();
}
},
open_video : function (e) {
var video = $(this).find('.flex-video'),
iframe = video.find('iframe');
if (iframe.length > 0) {
var data_src = iframe.attr('data-src');
if (typeof data_src === 'string') {
iframe[0].src = iframe.attr('data-src');
} else {
var src = iframe[0].src;
iframe[0].src = undefined;
iframe[0].src = src;
}
video.show();
}
},
cache_offset : function (modal) {
var offset = modal.show().height() + parseInt(modal.css('top'), 10);
modal.hide();
return offset;
},
off : function () {
$(this.scope).off('.fndtn.reveal');
},
reflow : function () {}
};
}(jQuery, this, this.document));
/*jslint unparam: true, browser: true, indent: 2 */
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.tab = {
name : 'tab',
version : '5.0.3',
settings : {
active_class: 'active',
callback : function () {}
},
init : function (scope, method, options) {
this.bindings(method, options);
},
events : function () {
$(this.scope).off('.tab').on('click.fndtn.tab', '[data-tab] > dd > a', function (e) {
e.preventDefault();
var tab = $(this).parent(),
tabs = tab.closest('[data-tab]'),
target = $('#' + this.href.split('#')[1]),
siblings = tab.siblings(),
settings = tabs.data('tab-init');
// allow usage of data-tab-content attribute instead of href
if ($(this).data('tab-content')) {
target = $('#' + $(this).data('tab-content').split('#')[1]);
}
tab.addClass(settings.active_class).trigger('opened');
siblings.removeClass(settings.active_class);
target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);
settings.callback(tab);
tabs.trigger('toggled', [tab]);
});
},
off : function () {},
reflow : function () {}
};
}(jQuery, this, this.document));
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.tooltip = {
name : 'tooltip',
version : '5.0.3',
settings : {
additional_inheritable_classes : [],
tooltip_class : '.tooltip',
append_to: 'body',
touch_close_text: 'Tap To Close',
disable_for_touch: false,
tip_template : function (selector, content) {
return '' + content + '';
}
},
cache : {},
init : function (scope, method, options) {
this.bindings(method, options);
},
events : function () {
var self = this;
if (Modernizr.touch) {
$(this.scope)
.off('.tooltip')
.on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
'[data-tooltip]', function (e) {
var settings = $.extend({}, self.settings, self.data_options($(this)));
if (!settings.disable_for_touch) {
e.preventDefault();
$(settings.tooltip_class).hide();
self.showOrCreateTip($(this));
}
})
.on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
this.settings.tooltip_class, function (e) {
e.preventDefault();
$(this).fadeOut(150);
});
} else {
$(this.scope)
.off('.tooltip')
.on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip',
'[data-tooltip]', function (e) {
var $this = $(this);
if (/enter|over/i.test(e.type)) {
self.showOrCreateTip($this);
} else if (e.type === 'mouseout' || e.type === 'mouseleave') {
self.hide($this);
}
});
}
},
showOrCreateTip : function ($target) {
var $tip = this.getTip($target);
if ($tip && $tip.length > 0) {
return this.show($target);
}
return this.create($target);
},
getTip : function ($target) {
var selector = this.selector($target),
tip = null;
if (selector) {
tip = $('span[data-selector="' + selector + '"]' + this.settings.tooltip_class);
}
return (typeof tip === 'object') ? tip : false;
},
selector : function ($target) {
var id = $target.attr('id'),
dataSelector = $target.attr('data-tooltip') || $target.attr('data-selector');
if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
dataSelector = 'tooltip' + Math.random().toString(36).substring(7);
$target.attr('data-selector', dataSelector);
}
return (id && id.length > 0) ? id : dataSelector;
},
create : function ($target) {
var $tip = $(this.settings.tip_template(this.selector($target), $('').html($target.attr('title')).html())),
classes = this.inheritable_classes($target);
$tip.addClass(classes).appendTo(this.settings.append_to);
if (Modernizr.touch) {
$tip.append(''+this.settings.touch_close_text+'');
}
$target.removeAttr('title').attr('title','');
this.show($target);
},
reposition : function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, column, objPos;
tip.css('visibility', 'hidden').show();
width = target.data('width');
nub = tip.children('.nub');
nubHeight = nub.outerHeight();
nubWidth = nub.outerHeight();
tip.css({'width' : (width) ? width : 'auto'});
objPos = function (obj, top, right, bottom, left, width) {
return obj.css({
'top' : (top) ? top : 'auto',
'bottom' : (bottom) ? bottom : 'auto',
'left' : (left) ? left : 'auto',
'right' : (right) ? right : 'auto'
}).end();
};
objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
if (this.small()) {
objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
tip.addClass('tip-override');
objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
} else {
var left = target.offset().left;
if (Foundation.rtl) {
left = target.offset().left + target.offset().width - tip.outerWidth();
}
objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
tip.removeClass('tip-override');
if (classes && classes.indexOf('tip-top') > -1) {
objPos(tip, (target.offset().top - tip.outerHeight() - 10), 'auto', 'auto', left)
.removeClass('tip-override');
} else if (classes && classes.indexOf('tip-left') > -1) {
objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
.removeClass('tip-override');
} else if (classes && classes.indexOf('tip-right') > -1) {
objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
.removeClass('tip-override');
}
}
tip.css('visibility', 'visible').hide();
},
small : function () {
return matchMedia(Foundation.media_queries.small).matches;
},
inheritable_classes : function (target) {
var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additional_inheritable_classes),
classes = target.attr('class'),
filtered = classes ? $.map(classes.split(' '), function (el, i) {
if ($.inArray(el, inheritables) !== -1) {
return el;
}
}).join(' ') : '';
return $.trim(filtered);
},
show : function ($target) {
var $tip = this.getTip($target);
this.reposition($target, $tip, $target.attr('class'));
$tip.fadeIn(150);
},
hide : function ($target) {
var $tip = this.getTip($target);
$tip.fadeOut(150);
},
// deprecate reload
reload : function () {
var $self = $(this);
return ($self.data('fndtn-tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init');
},
off : function () {
$(this.scope).off('.fndtn.tooltip');
$(this.settings.tooltip_class).each(function (i) {
$('[data-tooltip]').get(i).attr('title', $(this).text());
}).remove();
},
reflow : function () {}
};
}(jQuery, this, this.document));
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.topbar = {
name : 'topbar',
version: '5.0.3',
settings : {
index : 0,
sticky_class : 'sticky',
custom_back_text: true,
back_text: 'Back',
is_hover: true,
mobile_show_parent_link: false,
scrolltop : true // jump to top when sticky nav menu toggle is clicked
},
init : function (section, method, options) {
Foundation.inherit(this, 'addCustomRule register_media throttle');
var self = this;
self.register_media('topbar', 'foundation-mq-topbar');
this.bindings(method, options);
$('[data-topbar]', this.scope).each(function () {
var topbar = $(this),
settings = topbar.data('topbar-init'),
section = $('section', this),
titlebar = $('> ul', this).first();
topbar.data('index', 0);
var topbarContainer = topbar.parent();
if(topbarContainer.hasClass('fixed') || topbarContainer.hasClass(settings.sticky_class)) {
self.settings.sticky_class = settings.sticky_class;
self.settings.sticky_topbar = topbar;
topbar.data('height', topbarContainer.outerHeight());
topbar.data('stickyoffset', topbarContainer.offset().top);
} else {
topbar.data('height', topbar.outerHeight());
}
if (!settings.assembled) self.assemble(topbar);
if (settings.is_hover) {
$('.has-dropdown', topbar).addClass('not-click');
} else {
$('.has-dropdown', topbar).removeClass('not-click');
}
// Pad body when sticky (scrolled) or fixed.
self.addCustomRule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');
if (topbarContainer.hasClass('fixed')) {
$('body').addClass('f-topbar-fixed');
}
});
},
toggle: function (toggleEl) {
var self = this;
if (toggleEl) {
var topbar = $(toggleEl).closest('[data-topbar]');
} else {
var topbar = $('[data-topbar]');
}
var settings = topbar.data('topbar-init');
var section = $('section, .section', topbar);
if (self.breakpoint()) {
if (!self.rtl) {
section.css({left: '0%'});
$('>.name', section).css({left: '100%'});
} else {
section.css({right: '0%'});
$('>.name', section).css({right: '100%'});
}
$('li.moved', section).removeClass('moved');
topbar.data('index', 0);
topbar
.toggleClass('expanded')
.css('height', '');
}
if (settings.scrolltop) {
if (!topbar.hasClass('expanded')) {
if (topbar.hasClass('fixed')) {
topbar.parent().addClass('fixed');
topbar.removeClass('fixed');
$('body').addClass('f-topbar-fixed');
}
} else if (topbar.parent().hasClass('fixed')) {
if (settings.scrolltop) {
topbar.parent().removeClass('fixed');
topbar.addClass('fixed');
$('body').removeClass('f-topbar-fixed');
window.scrollTo(0,0);
} else {
topbar.parent().removeClass('expanded');
}
}
} else {
if(topbar.parent().hasClass(self.settings.sticky_class)) {
topbar.parent().addClass('fixed');
}
if(topbar.parent().hasClass('fixed')) {
if (!topbar.hasClass('expanded')) {
topbar.removeClass('fixed');
topbar.parent().removeClass('expanded');
self.update_sticky_positioning();
} else {
topbar.addClass('fixed');
topbar.parent().addClass('expanded');
$('body').addClass('f-topbar-fixed');
}
}
}
},
timer : null,
events : function (bar) {
var self = this;
$(this.scope)
.off('.topbar')
.on('click.fndtn.topbar', '[data-topbar] .toggle-topbar', function (e) {
e.preventDefault();
self.toggle(this);
})
.on('click.fndtn.topbar', '[data-topbar] li.has-dropdown', function (e) {
var li = $(this),
target = $(e.target),
topbar = li.closest('[data-topbar]'),
settings = topbar.data('topbar-init');
if(target.data('revealId')) {
self.toggle();
return;
}
if (self.breakpoint()) return;
if (settings.is_hover && !Modernizr.touch) return;
e.stopImmediatePropagation();
if (li.hasClass('hover')) {
li
.removeClass('hover')
.find('li')
.removeClass('hover');
li.parents('li.hover')
.removeClass('hover');
} else {
li.addClass('hover');
if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
e.preventDefault();
}
}
})
.on('click.fndtn.topbar', '[data-topbar] .has-dropdown>a', function (e) {
if (self.breakpoint()) {
e.preventDefault();
var $this = $(this),
topbar = $this.closest('[data-topbar]'),
section = topbar.find('section, .section'),
dropdownHeight = $this.next('.dropdown').outerHeight(),
$selectedLi = $this.closest('li');
topbar.data('index', topbar.data('index') + 1);
$selectedLi.addClass('moved');
if (!self.rtl) {
section.css({left: -(100 * topbar.data('index')) + '%'});
section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
} else {
section.css({right: -(100 * topbar.data('index')) + '%'});
section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
}
topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));
}
});
$(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {
self.resize.call(self);
}, 50)).trigger('resize');
$('body').off('.topbar').on('click.fndtn.topbar touchstart.fndtn.topbar', function (e) {
var parent = $(e.target).closest('li').closest('li.hover');
if (parent.length > 0) {
return;
}
$('[data-topbar] li').removeClass('hover');
});
// Go up a level on Click
$(this.scope).on('click.fndtn.topbar', '[data-topbar] .has-dropdown .back', function (e) {
e.preventDefault();
var $this = $(this),
topbar = $this.closest('[data-topbar]'),
section = topbar.find('section, .section'),
settings = topbar.data('topbar-init'),
$movedLi = $this.closest('li.moved'),
$previousLevelUl = $movedLi.parent();
topbar.data('index', topbar.data('index') - 1);
if (!self.rtl) {
section.css({left: -(100 * topbar.data('index')) + '%'});
section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
} else {
section.css({right: -(100 * topbar.data('index')) + '%'});
section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
}
if (topbar.data('index') === 0) {
topbar.css('height', '');
} else {
topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));
}
setTimeout(function () {
$movedLi.removeClass('moved');
}, 300);
});
},
resize : function () {
var self = this;
$('[data-topbar]').each(function () {
var topbar = $(this),
settings = topbar.data('topbar-init');
var stickyContainer = topbar.parent('.' + self.settings.sticky_class);
var stickyOffset;
if (!self.breakpoint()) {
var doToggle = topbar.hasClass('expanded');
topbar
.css('height', '')
.removeClass('expanded')
.find('li')
.removeClass('hover');
if(doToggle) {
self.toggle(topbar);
}
}
if(stickyContainer.length > 0) {
if(stickyContainer.hasClass('fixed')) {
// Remove the fixed to allow for correct calculation of the offset.
stickyContainer.removeClass('fixed');
stickyOffset = stickyContainer.offset().top;
if($(document.body).hasClass('f-topbar-fixed')) {
stickyOffset -= topbar.data('height');
}
topbar.data('stickyoffset', stickyOffset);
stickyContainer.addClass('fixed');
} else {
stickyOffset = stickyContainer.offset().top;
topbar.data('stickyoffset', stickyOffset);
}
}
});
},
breakpoint : function () {
return !matchMedia(Foundation.media_queries['topbar']).matches;
},
assemble : function (topbar) {
var self = this,
settings = topbar.data('topbar-init'),
section = $('section', topbar),
titlebar = $('> ul', topbar).first();
// Pull element out of the DOM for manipulation
section.detach();
$('.has-dropdown>a', section).each(function () {
var $link = $(this),
$dropdown = $link.siblings('.dropdown'),
url = $link.attr('href');
if (settings.mobile_show_parent_link && url && url.length > 1) {
var $titleLi = $('
- ' + $link.text() +'
');
} else {
var $titleLi = $('
');
}
// Copy link to subnav
if (settings.custom_back_text == true) {
$('h5>a', $titleLi).html(settings.back_text);
} else {
$('h5>a', $titleLi).html('« ' + $link.html());
}
$dropdown.prepend($titleLi);
});
// Put element back in the DOM
section.appendTo(topbar);
// check for sticky
this.sticky();
this.assembled(topbar);
},
assembled : function (topbar) {
topbar.data('topbar-init', $.extend({}, topbar.data('topbar-init'), {assembled: true}));
},
height : function (ul) {
var total = 0,
self = this;
$('> li', ul).each(function () { total += $(this).outerHeight(true); });
return total;
},
sticky : function () {
var $window = $(window),
self = this;
$(window).on('scroll', function() {
self.update_sticky_positioning();
});
},
update_sticky_positioning: function() {
var klass = '.' + this.settings.sticky_class;
var $window = $(window);
if ($(klass).length > 0) {
var distance = this.settings.sticky_topbar.data('stickyoffset');
if (!$(klass).hasClass('expanded')) {
if ($window.scrollTop() > (distance)) {
if (!$(klass).hasClass('fixed')) {
$(klass).addClass('fixed');
$('body').addClass('f-topbar-fixed');
}
} else if ($window.scrollTop() <= distance) {
if ($(klass).hasClass('fixed')) {
$(klass).removeClass('fixed');
$('body').removeClass('f-topbar-fixed');
}
}
}
}
},
off : function () {
$(this.scope).off('.fndtn.topbar');
$(window).off('.fndtn.topbar');
},
reflow : function () {}
};
}(jQuery, this, this.document));