/**
* eTabs.js v3.6.2
*/
;( function( window ) {
'use strict';
function extend( a, b ) {
for( var key in b ) {
if( b.hasOwnProperty( key ) ) {
a[key] = b[key];
}
}
return a;
}
function IW_Tabs( el, options ) {
this.el = el;
this.options = extend( {}, this.options );
extend( this.options, options );
this._init();
}
IW_Tabs.prototype.options = {
start : 0
};
IW_Tabs.prototype._init = function() {
// tabs elems
this.tabs = [].slice.call( this.el.querySelectorAll( 'nav > ul > li' ) );
// content items
this.items = [].slice.call( this.el.querySelectorAll( '.et-content-wrap > section' ) );
// current index
this.current = -1;
// show current content item
this._show();
// init events
this._initEvents();
};
IW_Tabs.prototype._initEvents = function() {
var self = this;
this.tabs.forEach( function( tab, idx ) {
tab.addEventListener( 'click', function( ev ) {
var showHideAttr = jQuery( tab ).parents( '.et-tabs' ).data( 'show-hide' ),
show = self._showHideTab( jQuery( tab ).attr( 'class' ), showHideAttr );
ev.preventDefault();
jQuery(document).trigger("resize");
if ( show ) {
self._show( idx );
}
// Check if is sticky tab and scroll up to the tab content start position.
if ( jQuery( tab ).parents( '.et-tabs' ).hasClass( 'et-tabs-sticky' ) ) {
var headerHeight = jQuery( tab ).parents( '.et-tabs' ).attr( 'data-header-height' );
headerHeight = parseInt( headerHeight );
jQuery( 'html, body' ).animate( { scrollTop:( jQuery( tab ).parents( '.et-tabs' ).offset().top ) - ( headerHeight + 40 ) }, 300 );
}
} );
} );
};
IW_Tabs.prototype._show = function( idx ) {
if( this.current >= 0 ) {
this.tabs[ this.current ].className = this.items[ this.current ].className = '';
}
this.tabs.forEach( function( tab, idx ) {
tab.className = "";
});
// change current
this.current = idx != undefined ? idx : this.options.start >= 0 && this.options.start < this.items.length ? this.options.start : 0;
var hash = jQuery( jQuery( this.tabs[ this.current ] ).find( 'a' )[0] ).data('href');
hash = ( 'undefined' !== typeof hash ) ? hash.substr( hash.indexOf("#") ) : '';
setTimeout( function(){
jQuery(document).trigger("elegantTabSwitched",[hash]);
}, 100 );
var anim = jQuery(this.items[ this.current ]).data('animation');
this.items.forEach( function( tab, idx ) {
tab.className = '';
} );
// Make first tab inactive.
if ( -1 == this.options.start ) {
var loaded = jQuery( jQuery( this.tabs[ this.current ] ).parents( '.elegant-tabs-container' )[0] ).data( 'loaded' );
if ( 'undefined' !== typeof loaded || loaded ) {
this.tabs[ this.current ].className = 'tab-current';
this.items[ this.current ].className = 'content-current';
jQuery( this.items[ this.current ] ).find( '.infi-content-wrapper' )[0].className = 'infi-content-wrapper animated '+anim;
}
jQuery( jQuery( this.tabs[ this.current ] ).parents( '.elegant-tabs-container' )[0] ).attr('data-loaded', true );
} else {
this.tabs[ this.current ].className = 'tab-current';
this.items[ this.current ].className = 'content-current';
jQuery( this.items[ this.current ] ).find( '.infi-content-wrapper' )[0].className = 'infi-content-wrapper animated '+anim;
}
},
IW_Tabs.prototype._showHideTab = function( cls, showHideAttr ) {
if ( showHideAttr ) {
this.items.forEach( function( tab, idx ) {
tab.className = '';
} );
this.tabs.forEach( function( tabContent, idx ) {
tabContent.className = '';
} );
if ( 'tab-current' === cls ) {
return false;
} else {
return true;
}
} else {
return true;
}
};
// add to global namespace
window.IW_Tabs = IW_Tabs;
})( window );
function checkHash( hashLink ) {
if ( hashLink !== '' ) {
hash = hashLink.substr(hashLink.indexOf("#") );
if ( jQuery( hash ).length ) {
var animation = jQuery( hash ).data( 'animation' ),
tab_link = jQuery('a[data-href="'+hash+'"]').parents("ul").find('li'),
tabs = jQuery(hash).parents(".et-tabs").find("section");
tab_link.removeClass('tab-current');
tab_link.each(function(index, element) {
jQuery(this).removeClass('tab-current');
});
tabs.each(function(index, element) {
jQuery(this).removeClass('content-current');
});
jQuery('a[data-href="'+hash+'"]').parent('li').addClass('tab-current');
jQuery( hash + ' > .infi-content-wrapper' )[0].className = 'infi-content-wrapper animated ' + animation;
jQuery(hash).addClass('content-current');
setTimeout( function(){
jQuery(document).trigger("elegantTabSwitched",[hash]);
}, 100 );
}
}
}
function checkHashPosition( hash ) {
var hashPosition = 0;
hashPosition = jQuery( 'a[data-href="' + hash + '"]' ).parent( 'li' ).index();
return hashPosition;
}
function elegantAutoSwitchTabs( el, interval, startTab ) {
var timeInterval, tabCount = 0, currnetIndex = 1;
tabCount = jQuery( el ).find( 'li' ).length;
currnetIndex = startTab + 1;
changeTabIndex();
timeInterval = setInterval( function () { changeTabIndex(); }, interval * 1000);
function changeTabIndex() {
if ( currnetIndex > tabCount ) {
currnetIndex = 1;
}
var currentAncorObj = jQuery( el ).find( 'li' ).eq( currnetIndex - 1 );
jQuery( currentAncorObj ).trigger( 'click' );
currnetIndex++;
};
jQuery( el ).find( 'li' ).mouseenter( function () {
clearInterval( timeInterval );
}).mouseleave( function () {
timeInterval = setInterval( function () { changeTabIndex(); }, interval * 1000);
});
}
// Check if the device is touch capable.
function isDeviceTouchEnabled( event ) {
// Checking with the screen type - necessary for IOS detection.
var isTouchCapable = 'ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0;
// Checking with pointer type detection.
switch( event.pointerType ) {
case "mouse":
// mouse input detected
isTouchCapable = false;
break;
case "pen":
// pen/stylus input detected
isTouchCapable = false;
break;
case "touch":
// touch input detected
isTouchCapable = true;
break;
default:
// default to the screen type.
break;
}
return isTouchCapable;
}
function etGenerateCSS() {
var css = '';
jQuery("head").append(css);
}
/* Call tabs function */
(function() {
etGenerateCSS();
[].slice.call( document.querySelectorAll( '.et-mobile-enabled' ) ).forEach( function( el ) {
// Create the dropdown base
var nav = jQuery(el).find("nav");
jQuery("", { "class":"et-mobile-tabs"}).appendTo( nav );
// Populate dropdown with menu items
nav.find("a").each(function() {
var el = jQuery(this);
jQuery("", {
"value" : el.attr("data-href"),
"text" : el.find('.et-tab-title').text()
}).appendTo(nav.find("select") );
});
nav.find( "select" ).change( function() {
var hashLink = jQuery( this ).find( "option:selected" ).val();
checkHash( hashLink );
});
});
jQuery("a").not('.et-anchor-tag').click( function(e){
var url = jQuery(this).attr("href");
if( url !== "" && typeof url !== "undefined"){
var isHash = url.indexOf('#section');
var isTabPage = '';
hash = url.substring(url.indexOf('#section'));
if( isHash !== -1 ){
isTabPage = jQuery(hash).length;
}
if( isHash !== -1 && isTabPage ) {
e.preventDefault();
checkHash( url );
jQuery( 'html, body' ).animate( { scrollTop:( ( jQuery(hash) ).offset().top ) - 150 }, 300 );
}
}
});
jQuery(".et-anchor-tag").hover(
function(){
if ( ! jQuery(this).parent('li').hasClass('tab-current') ) {
var hover_src = jQuery(this).find('.elegant-tabs-image-icon').data( 'hover-src' );
if ( '' !== hover_src ) {
jQuery(this).find('.elegant-tabs-image-icon').attr( 'src', hover_src );
}
}
},
function(){
if ( ! jQuery(this).parent('li').hasClass('tab-current') ) {
var original_src = jQuery(this).find('.elegant-tabs-image-icon').data( 'original-src' );
jQuery(this).find('.elegant-tabs-image-icon').attr( 'src', original_src );
}
}
);
jQuery( '.et-switch-on-hover .et-anchor-tag' ).on( 'hover mouseenter', function() {
jQuery( this ).parent( 'li' ).trigger( 'click' );
} );
jQuery( '.et-switch-on-hover .et-anchor-tag' ).on( 'pointerdown MSPointerDown', function( event ) {
if ( jQuery( this ).hasClass( 'touchstart' ) ) {
jQuery( this ).removeClass( 'touchstart' );
}
if ( isDeviceTouchEnabled( event ) && ! jQuery( this ).parent('li').hasClass( 'tab-current' ) ) {
if ( jQuery( this ).hasClass( 'title-link-double-tap' ) ) {
jQuery( this ).toggleClass( 'touchstart' );
}
} else {
jQuery( this ).parent( 'li' ).trigger( 'click' );
}
} );
jQuery( '.et-anchor-tag.title-has-link' ).click( function( e ) {
var href = jQuery( this ).attr('href'),
target = jQuery( this ).attr('target');
if ( ! jQuery( this ).hasClass( 'touchstart' ) ) {
if ( '_blank' === target ) {
window.open( href );
} else {
window.location = href;
}
}
} );
jQuery( document ).on( 'elegantTabSwitched', function( e, hash ) {
jQuery( document ).trigger( 'resize' );
if ( typeof wpb_prepare_tab_content == 'function' ) {
wpb_prepare_tab_content( e, { newPanel: jQuery( '.et-content-wrap' ) } );
}
jQuery( hash ).parents( '.et-tabs' ).find( '.et-mobile-tabs' ).val( hash );
jQuery( hash ).parent( '.et-content-wrap' ).find( '.infi-tab-accordion' ).removeClass( 'infi-active-tab' );
jQuery('div[data-href="'+hash+'"]').parents( '.infi-tab-accordion' ).addClass( 'infi-active-tab' );
jQuery( hash ).siblings().find('iframe').each( function( i ) {
jQuery(this).attr('src', jQuery(this).attr('src'));
} );
var hover_src = jQuery('[data-href*="'+hash+'"]').find('.elegant-tabs-image-icon').data( 'hover-src' );
jQuery('a[data-href*="'+hash+'"]').parents( '.elegant-tabs-list-container' ).find( '.elegant-tabs-image-icon' ).each( function(){
var original_src = jQuery(this).data( 'original-src' );
jQuery(this).attr( 'src', original_src );
});
if ( '' !== hover_src ) {
jQuery('a[data-href*="'+hash+'"]').find('.elegant-tabs-image-icon').attr( 'src', hover_src );
if ( ! jQuery( 'div[data-href*="'+hash+'"]' ).parents( '.et-tabs' ).hasClass( 'et-accordions-closed' ) ) {
jQuery('div[data-href*="'+hash+'"]').find('.elegant-tabs-image-icon').attr( 'src', hover_src );
}
}
});
// Responsive Tabs.
jQuery(document).ready( function(){
var accHD = document.getElementsByClassName('infi-accordion-item-heading');
for (i = 0; i < accHD.length; i++) {
accHD[i].addEventListener('click', toggleItem.bind( self, i), false);
}
function toggleItem( index, event ) {
var $this = jQuery( event.target ),
hash = $this.data('href'),
itemID,
animation,
hashLink,
hover_src = '';
if ( typeof hash == 'undefined' ) {
hash = $this.parent( '.infi-accordion-item-heading' ).data( 'href' );
$this = $this.parent( '.infi-accordion-item-heading' );
}
itemID = hash;
animation = jQuery( itemID ).data( 'animation' );
jQuery( itemID ).parents( '.et-tabs' ).find( 'nav > ul li').removeClass( 'tab-current' );
jQuery( itemID ).parents( '.et-tabs' ).find( 'a[data-href="' + itemID +'"]').parents( 'li' ).addClass( 'tab-current' );
jQuery( itemID ).parent( '.et-content-wrap' ).find( 'section' ).removeClass( 'content-current' );
jQuery( itemID ).parent( '.et-content-wrap' ).find( '.infi-tab-accordion' ).removeClass( 'infi-active-tab' );
$this.parents( '.infi-tab-accordion' ).addClass( 'infi-active-tab' );
hover_src = jQuery('.infi-accordion-item-heading[data-href*="'+hash+'"]').find('.elegant-tabs-image-icon').data( 'hover-src' );
jQuery('.infi-accordion-item-heading[data-href*="'+hash+'"]').parents( '.et-content-wrap' ).find( '.elegant-tabs-image-icon' ).each( function(){
var original_src = jQuery(this).data( 'original-src' );
jQuery(this).attr( 'src', original_src );
});
if ( '' !== hover_src ) {
jQuery('.infi-accordion-item-heading[data-href*="'+hash+'"]').find('.elegant-tabs-image-icon').attr( 'src', hover_src );
}
jQuery( itemID )[0].className = 'content-current';
jQuery( itemID + ' > .infi-content-wrapper' )[0].className = 'infi-content-wrapper animated ' + animation;
jQuery( 'html, body' ).animate( { scrollTop:( ( $this ).offset().top ) - 85 }, 300 );
}
// Set all accordions to closed.
if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
setTimeout( function() {
jQuery( '.et-tabs.et-accordions-closed' ).each( function( index, tabs ) {
jQuery( tabs ).find( '.content-current' ).removeClass( 'content-current' );
jQuery( tabs ).find( '.infi-active-tab' ).removeClass( 'infi-active-tab' );
} );
}, 102 );
}
});
jQuery( document ).ready( function() {
// Tabs to carousel.
jQuery( '.et-tabs.et-tabs-carousel:not(.et-vertical)' ).each( function() {
var $thisTabs = jQuery( this ),
tabNavContainer = $thisTabs.find( '.elegant-tabs-list-container' ),
tabNavContainerWidth = 0,
tabNavWidth = 0,
singletabNavWidth = 0,
singletabNavHeight = 0,
nextTabWidth = 0,
tabNavStyle = '',
tabIconColor = $thisTabs.attr( 'data-arrow-color' ),
tabIconBgColor = $thisTabs.attr( 'data-arrow-bg-color' ),
nextTabIcon = '',
prevTabIcon = '';
if ( tabNavContainer.length ) {
tabNavContainerWidth = tabNavContainer.width();
}
jQuery( tabNavContainer ).find( 'li' ).each( function() {
tabNavWidth += jQuery( this ).width();
singletabNavWidth = jQuery( this ).width();
singletabNavHeight = jQuery( this ).height();
} );
if ( tabNavWidth > tabNavContainerWidth ) {
tabNavContainerWidth = tabNavContainerWidth - 32;
tabNavStyle = $thisTabs.find( '.elegant-tabs-nav' ).attr( 'style' );
$thisTabs.find( '.elegant-tabs-nav' ).attr( 'style', tabNavStyle + ';width:' + tabNavContainerWidth + 'px;padding-left:32px;' + 'overflow: hidden !important;' );
tabNavContainer.css( { width: tabNavWidth + 20 } );
tabIconBgColor = ( 'undefined' !== typeof tabIconBgColor ) ? tabIconBgColor : '#ddd';
jQuery( '' + prevTabIcon + '' ).insertBefore( tabNavContainer );
jQuery( '' + nextTabIcon + '' ).insertAfter( tabNavContainer );
$thisTabs.find( '.et-prev-tab' ).on( 'click', function() {
var lastTab = jQuery( this ).next( '.elegant-tabs-list-container' ).find( 'li:last-child' ),
firstTab = jQuery( this ).next( '.elegant-tabs-list-container' ).find( 'li:first-child' )
clone = jQuery( lastTab ).clone();
if ( lastTab.length ) {
lastTabWidth = lastTab.width();
lastTab.css( { marginLeft: -lastTabWidth } );
// firstTab.css( { marginLeft: lastTabWidth } );
tabNavContainer.css( { width: tabNavWidth + 500 } );
tabNavContainer.prepend( lastTab );
tabNavContainer.append( clone );
setTimeout( function(){
lastTab.css( { marginLeft: 0 } );
firstTab.css( { marginLeft: 0 } );
clone.remove();
});
}
} );
$thisTabs.find( '.et-next-tab' ).on( 'click', function() {
var nextTab = jQuery( this ).prev( '.elegant-tabs-list-container' ).find( 'li:first-child' ),
clone = jQuery( nextTab ).clone();
if ( nextTab.length ) {
nextTabWidth = nextTab.width();
nextTab.css( { marginLeft: -nextTabWidth } );
tabNavContainer.css( { width: tabNavWidth + 500 } );
tabNavContainer.append( clone );
setTimeout( function(){
nextTab.css( { marginLeft: 0 } );
tabNavContainer.append( nextTab );
clone.remove();
}, 200 );
}
} );
}
} );
} );
})();