/** * 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("