this.isStuck = false;
if(this.options.anchor !== ''){
- this.$anchor = $('#' + this.options.anchor);
+ this.$anchor = $(`#${this.options.anchor}`);
}else{
this._parsePoints();
}
pt = pts[i];
}else{
var place = pts[i].split(':'),
- anchor = $('#' + place[0]);
+ anchor = $(`#${place[0]}`);
pt = anchor.offset().top;
if(place[1] && place[1].toLowerCase() === 'bottom'){
*/
Sticky.prototype._events = function(id){
var _this = this,
- scrollListener = this.scrollListener = 'scroll.zf.' + id;
+ scrollListener = this.scrollListener = `scroll.zf.${id}`;
if(this.isOn){ return; }
if(this.canStick){
this.isOn = true;
notStuckTo = stickTo === 'top' ? 'bottom' : 'top',
css = {};
- css[mrgn] = this.options[mrgn] + 'em';
+ css[mrgn] = `${this.options[mrgn]}em`;
css[stickTo] = 0;
css[notStuckTo] = 'auto';
css['left'] = this.$container.offset().left + parseInt(window.getComputedStyle(this.$container[0])["padding-left"], 10);
this.isStuck = true;
- this.$element.removeClass('is-anchored is-at-' + notStuckTo)
- .addClass('is-stuck is-at-' + stickTo)
+ this.$element.removeClass(`is-anchored is-at-${notStuckTo}`)
+ .addClass(`is-stuck is-at-${stickTo}`)
.css(css)
/**
* Fires when the $element has become `position: fixed;`
* Namespaced to `top` or `bottom`.
* @event Sticky#stuckto
*/
- .trigger('sticky.zf.stuckto:' + stickTo);
+ .trigger(`sticky.zf.stuckto:${stickTo}`);
};
/**
css['left'] = '';
this.isStuck = false;
- this.$element.removeClass('is-stuck is-at-' + stickTo)
- .addClass('is-anchored is-at-' + topOrBottom)
+ this.$element.removeClass(`is-stuck is-at-${stickTo}`)
+ .addClass(`is-anchored is-at-${topOrBottom}`)
.css(css)
/**
* Fires when the $element has become anchored.
* Namespaced to `top` or `bottom`.
* @event Sticky#unstuckfrom
*/
- .trigger('sticky.zf.unstuckfrom:' + topOrBottom);
+ .trigger(`sticky.zf.unstuckfrom:${topOrBottom}`);
};
/**
}
this.$element.css({
- 'max-width': newElemWidth - pdng + 'px'
+ 'max-width': `${newElemWidth - pdng}px`
});
var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight;
Sticky.prototype.destroy = function(){
this._removeSticky(true);
- this.$element.removeClass(this.options.stickyClass + ' is-anchored is-at-top')
+ this.$element.removeClass(`${this.options.stickyClass} is-anchored is-at-top`)
.css({
height: '',
top: '',
Tabs.prototype._init = function(){
var _this = this;
- this.$tabTitles = this.$element.find('.' + this.options.linkClass);
- this.$tabContent = $('[data-tabs-content="' + this.$element[0].id + '"]');
+ this.$tabTitles = this.$element.find(`.${this.options.linkClass}`);
+ this.$tabContent = $(`[data-tabs-content="${this.$element[0].id}"]`);
this.$tabTitles.each(function(){
var $elem = $(this),
$link = $elem.find('a'),
isActive = $elem.hasClass('is-active'),
hash = $link[0].hash.slice(1),
- linkId = $link[0].id ? $link[0].id : hash + '-label',
- $tabContent = $('#' + hash);
+ linkId = $link[0].id ? $link[0].id : `hash${-label}`,
+ $tabContent = $(`#${hash}`);
$elem.attr({'role': 'presentation'});
Tabs.prototype._addClickHandler = function(){
var _this = this;
this.$element.off('click.zf.tabs')
- .on('click.zf.tabs', '.' + this.options.linkClass, function(e){
+ .on('click.zf.tabs', `.${this.options.linkClass}`, function(e){
e.preventDefault();
e.stopPropagation();
if($(this).hasClass('is-active')){
var $tabLink = $target.find('[role="tab"]'),
hash = $tabLink[0].hash,
$targetContent = $(hash),
- $oldTab = this.$element.find('.' + this.options.linkClass + '.is-active')
+ $oldTab = this.$element.find(`.${this.options.linkClass}.is-active`)
.removeClass('is-active').find('[role="tab"]')
.attr({'aria-selected': 'false'}).attr('aria-controls');
- $('#'+$oldTab).removeClass('is-active').attr({'aria-hidden': 'true'});
+ $(`#${$oldTab}`).removeClass('is-active').attr({'aria-hidden': 'true'});
$target.addClass('is-active');
}
if(idStr.indexOf('#') < 0){
- idStr = '#' + idStr;
+ idStr = `#${idStr}`;
}
- var $target = this.$tabTitles.find('[href="' + idStr + '"]').parent('.' + this.options.linkClass);
+ var $target = this.$tabTitles.find(`[href="${idStr}"]`).parent(`.${this.options.linkClass}`);
this._handleTabChange($target);
};
*/
Tabs.prototype._setHeight = function(){
var max = 0;
- this.$tabContent.find('.' + this.options.panelClass)
+ this.$tabContent.find(`.${this.options.panelClass}`)
.css('height', '')
.each(function(){
var panel = $(this),
max = temp > max ? temp : max;
})
- .css('height', max + 'px');
+ .css('height', `${max}px`);
};
/**
* @fires Tabs#destroyed
*/
Tabs.prototype.destroy = function() {
- this.$element.find('.' + this.options.linkClass)
+ this.$element.find(`.${this.options.linkClass}`)
.off('.zf.tabs').hide().end()
- .find('.' + this.options.panelClass)
+ .find(`.${this.options.panelClass}`)
.hide();
if(this.options.matchHeight){
$(window).off('changed.zf.mediaquery');
// Add ARIA attributes to triggers
var id = this.$element[0].id;
- $('[data-open="'+id+'"], [data-close="'+id+'"], [data-toggle="'+id+'"]')
+ $(`[data-open="${id}"], [data-close="${id}"], [data-toggle="${id}"]`)
.attr('aria-controls', id);
// If the target is hidden, add aria-hidden
this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true);
* @private
*/
Tooltip.prototype._buildTemplate = function(id){
- var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass + ' ' + this.options.templateClasses).trim();
+ var templateClasses = (`${this.options.tooltipClass} ${this.options.positionClass} ${this.options.templateClasses}`).trim();
var $template = $('<div></div>').addClass(templateClasses).attr({
'role': 'tooltip',
'aria-hidden': true,
*/
var parseKey = function(event) {
var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase();
- if (event.shiftKey) key = 'SHIFT_' + key;
- if (event.ctrlKey) key = 'CTRL_' + key;
- if (event.altKey) key = 'ALT_' + key;
+ if (event.shiftKey) key = `SHIFT_${key}`;
+ if (event.ctrlKey) key = `CTRL_${key}`;
+ if (event.altKey) key = `ALT_${key}`;
return key;
};
Foundation.Keyboard.parseKey = parseKey;
for (var key in namedQueries) {
self.queries.push({
name: key,
- value: 'only screen and (min-width: ' + namedQueries[key] + ')'
+ value: `only screen and (min-width: ${namedQueries[key]})`
});
}
styleMedia = {
matchMedium: function(media) {
- var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
+ var text = `@media ${media}{ #matchmediajs-test { width: 1px; } }`;
// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
if (style.styleSheet) {
// Resets transitions and removes motion-specific classes
function reset() {
element[0].style.transitionDuration = 0;
- element.removeClass(initClass + ' ' + activeClass + ' ' + animation);
+ element.removeClass(`${initClass} ${activeClass} ${animation}`);
}
}
menu.attr('role', 'menubar');
type = type || 'zf';
var items = menu.find('li').attr({'role': 'menuitem'}),
- subMenuClass = 'is-' + type + '-submenu',
- subItemClass = subMenuClass + '-item',
- hasSubClass = 'is-' + type + '-submenu-parent';
+ subMenuClass = `is-${type}-submenu`,
+ subItemClass = `${subMenuClass}-item`,
+ hasSubClass = `is-${type}-submenu-parent`;
menu.find('a:first').attr('tabindex', 0);
items.each(function(){
var $item = $(this),
'aria-expanded': false,
'aria-label': $item.children('a:first').text()
});
- $sub.addClass('submenu ' + subMenuClass)
+ $sub.addClass(`submenu ${subMenuClass}`)
.attr({
'data-submenu': '',
'aria-hidden': true,
});
}
if($item.parent('[data-submenu]').length){
- $item.addClass('is-submenu-item ' + subItemClass);
+ $item.addClass(`is-submenu-item ${subItemClass}`);
}
});
return;
},
Burn: function(menu, type){
var items = menu.find('li').removeAttr('tabindex'),
- subMenuClass = 'is-' + type + '-submenu',
- subItemClass = subMenuClass + '-item',
- hasSubClass = 'is-' + type + '-submenu-parent';
+ subMenuClass = `is-${type}-submenu`,
+ subItemClass = `${subMenuClass}-item`,
+ hasSubClass = `is-${type}-submenu-parent`;
// menu.find('.is-active').removeClass('is-active');
menu.find('*')
// menu.find('.' + subMenuClass + ', .' + subItemClass + ', .is-active, .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
- .removeClass(subMenuClass + ' ' + subItemClass + ' ' + hasSubClass + ' is-submenu-item submenu is-active')
+ .removeClass(`${subMenuClass} ${subItemClass} ${hasSubClass} is-submenu-item submenu is-active`)
.removeAttr('data-submenu').css('display', '');
// console.log( menu.find('.' + subMenuClass + ', .' + subItemClass + ', .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
}
cb();
}, remain);
- elem.trigger('timerstart.zf.' + nameSpace);
+ elem.trigger(`timerstart.zf.${nameSpace}`);
};
this.pause = function(){
elem.data('paused', true);
var end = Date.now();
remain = remain - (end - start);
- elem.trigger('timerpaused.zf.' + nameSpace);
+ elem.trigger(`timerpaused.zf.${nameSpace}`);
};
};
/**
if(dir) {
e.preventDefault();
onTouchEnd.call(this);
- $(this).trigger('swipe', dir).trigger('swipe' + dir);
+ $(this).trigger('swipe', dir).trigger(`swipe${dir}`);
}
}
}
$.event.special.swipe = { setup: init };
$.each(['left', 'up', 'down', 'right'], function () {
- $.event.special['swipe' + this] = { setup: function(){
+ $.event.special[`swipe${this}`] = { setup: function(){
$(this).on('swipe', $.noop);
} };
});
var MutationObserver = (function () {
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
for (var i=0; i < prefixes.length; i++) {
- if (prefixes[i] + 'MutationObserver' in window) {
- return window[prefixes[i] + 'MutationObserver'];
+ if (`${prefixes[i]}MutationObserver` in window) {
+ return window[`${prefixes[i]}MutationObserver`];
}
}
return false;
$(window).off(listeners).on(listeners, function(e, pluginId){
var plugin = e.namespace.split('.')[0];
- var plugins = $('[data-' + plugin + ']').not('[data-yeti-box="' + pluginId + '"]');
+ var plugins = $(`[data-${plugin}]`).not(`[data-yeti-box="${pluginId}"]`);
plugins.each(function(){
var _this = $(this);