(function($){ var $et_window = $(window); window.et_load_event_fired = false; jQuery.fn.reverse = [].reverse; jQuery.fn.closest_descendent = function( selector ) { var $found, $current_children = this.children(); while ( $current_children.length ) { $found = $current_children.filter( selector ); if ( $found.length ) { break; } $current_children = $current_children.children(); } return $found; }; window.et_pb_init_modules = function() { $.et_pb_simple_slider = function(el, options) { var settings = $.extend( { slide : '.et-slide', // slide class arrows : '.et-pb-slider-arrows', // arrows container class prev_arrow : '.et-pb-arrow-prev', // left arrow class next_arrow : '.et-pb-arrow-next', // right arrow class controls : '.et-pb-controllers a', // control selector carousel_controls : '.et_pb_carousel_item', // carousel control selector control_active_class : 'et-pb-active-control', // active control class name previous_text : et_pb_custom.previous, // previous arrow text next_text : et_pb_custom.next, // next arrow text fade_speed : 500, // fade effect speed use_arrows : true, // use arrows? use_controls : true, // use controls? manual_arrows : '', // html code for custom arrows append_controls_to : '', // controls are appended to the slider element by default, here you can specify the element it should append to controls_below : false, controls_class : 'et-pb-controllers', // controls container class name slideshow : false, // automattic animation? slideshow_speed : 7000, // automattic animation speed show_progress_bar : false, // show progress bar if automattic animation is active tabs_animation : false, use_carousel : false }, options ); var $et_slider = $(el), $et_slide = $et_slider.closest_descendent( settings.slide ), et_slides_number = $et_slide.length, et_fade_speed = settings.fade_speed, et_active_slide = 0, $et_slider_arrows, $et_slider_prev, $et_slider_next, $et_slider_controls, $et_slider_carousel_controls, et_slider_timer, controls_html = '', carousel_html = '', $progress_bar = null, progress_timer_count = 0, $et_pb_container = $et_slider.find( '.et_pb_container' ), et_pb_container_width = $et_pb_container.width(), is_post_slider = $et_slider.hasClass( 'et_pb_post_slider' ); $et_slider.et_animation_running = false; $.data(el, "et_pb_simple_slider", $et_slider); $et_slide.eq(0).addClass( 'et-pb-active-slide' ); if ( ! settings.tabs_animation ) { if ( !$et_slider.hasClass('et_pb_bg_layout_dark') && !$et_slider.hasClass('et_pb_bg_layout_light') ) { $et_slider.addClass( et_get_bg_layout_color( $et_slide.eq(0) ) ); } } if ( settings.use_arrows && et_slides_number > 1 ) { if ( settings.manual_arrows == '' ) $et_slider.append( '
' + '' +settings.previous_text + '' + '' + '' + settings.next_text + '' + '
' ); else $et_slider.append( settings.manual_arrows ); $et_slider_arrows = $et_slider.find( settings.arrows ); $et_slider_prev = $et_slider.find( settings.prev_arrow ); $et_slider_next = $et_slider.find( settings.next_arrow ); $et_slider_next.click( function(){ if ( $et_slider.et_animation_running ) return false; $et_slider.et_slider_move_to( 'next' ); return false; } ); $et_slider_prev.click( function(){ if ( $et_slider.et_animation_running ) return false; $et_slider.et_slider_move_to( 'previous' ); return false; } ); // swipe support requires et-jquery-touch-mobile $et_slider.find( settings.slide ).on( 'swipeleft', function( event ) { // do not switch slide on selecting text in VB if ( $( event.target ).closest( '.et-fb-popover-tinymce' ).length || $( event.target ).closest( '.et-fb-editable-element' ).length ) { return; } $et_slider.et_slider_move_to( 'next' ); }); $et_slider.find( settings.slide ).on( 'swiperight', function( event ) { // do not switch slide on selecting text in VB if ( $( event.target ).closest( '.et-fb-popover-tinymce' ).length || $( event.target ).closest( '.et-fb-editable-element' ).length ) { return; } $et_slider.et_slider_move_to( 'previous' ); }); } if ( settings.use_controls && et_slides_number > 1 ) { for ( var i = 1; i <= et_slides_number; i++ ) { controls_html += '' + i + ''; } if ($et_slider.find('video').length > 0) { settings.controls_class += ' et-pb-controllers-has-video-tag'; } controls_html = '
' + controls_html + '
'; if ( settings.append_controls_to == '' ) $et_slider.append( controls_html ); else $( settings.append_controls_to ).append( controls_html ); if ( settings.controls_below ) $et_slider_controls = $et_slider.parent().find( settings.controls ); else $et_slider_controls = $et_slider.find( settings.controls ); et_maybe_set_controls_color( $et_slide.eq(0) ); $et_slider_controls.click( function(){ if ( $et_slider.et_animation_running ) return false; $et_slider.et_slider_move_to( $(this).index() ); return false; } ); } if ( settings.use_carousel && et_slides_number > 1 ) { for ( var i = 1; i <= et_slides_number; i++ ) { slide_id = i - 1; image_src = ( $et_slide.eq(slide_id).data('image') !== undefined ) ? 'url(' + $et_slide.eq(slide_id).data('image') + ')' : 'none'; carousel_html += ''; } carousel_html = ''; $et_slider.after( carousel_html ); $et_slider_carousel_controls = $et_slider.siblings('.et_pb_carousel').find( settings.carousel_controls ); $et_slider_carousel_controls.click( function(){ if ( $et_slider.et_animation_running ) return false; var $this = $(this); $et_slider.et_slider_move_to( $this.data('slide-id') ); return false; } ); } if ( settings.slideshow && et_slides_number > 1 ) { $et_slider.hover( function() { if ( $et_slider.hasClass( 'et_slider_auto_ignore_hover' ) ) { return; } $et_slider.addClass( 'et_slider_hovered' ); if ( typeof et_slider_timer != 'undefined' ) { clearInterval( et_slider_timer ); } }, function() { if ( $et_slider.hasClass( 'et_slider_auto_ignore_hover' ) ) { return; } $et_slider.removeClass( 'et_slider_hovered' ); et_slider_auto_rotate(); } ); } et_slider_auto_rotate(); function et_slider_auto_rotate(){ if ( settings.slideshow && et_slides_number > 1 && ! $et_slider.hasClass( 'et_slider_hovered' ) ) { et_slider_timer = setTimeout( function() { $et_slider.et_slider_move_to( 'next' ); }, settings.slideshow_speed ); } } $et_slider.et_slider_destroy = function() { // Clear existing timer / auto rotate if ( typeof et_slider_timer != 'undefined' ) { clearInterval( et_slider_timer ); } // Deregister existing events $et_slider.unbind('mouseenter mouseleave'); $et_slider.find('.et-pb-slider-arrows a, .et-pb-controllers a').unbind('click'); // Removing existing style from slide(s) $et_slider.find('.et_pb_slide').css({ 'z-index': '', 'display': '', 'opacity': '', }); // Removing existing classnames from slide(s) $et_slider.find('.et-pb-active-slide').removeClass('et-pb-active-slide'); $et_slider.find('.et-pb-moved-slide').removeClass('et-pb-moved-slide'); // Removing DOM that was added by slider $et_slider.find('.et-pb-slider-arrows, .et-pb-controllers').remove(); $et_slider.siblings('.et_pb_carousel').remove(); } function et_stop_video( active_slide ) { var $et_video, et_video_src; // if there is a video in the slide, stop it when switching to another slide if ( active_slide.has( 'iframe' ).length ) { $et_video = active_slide.find( 'iframe' ); et_video_src = $et_video.attr( 'src' ); $et_video.attr( 'src', '' ); $et_video.attr( 'src', et_video_src ); } else if ( active_slide.has( 'video' ).length ) { if ( !active_slide.find('.et_pb_section_video_bg').length ) { $et_video = active_slide.find( 'video' ); $et_video[0].pause(); } } } function et_fix_slider_content_images() { var $this_slider = $et_slider, $slide_image_container = $this_slider.find( '.et-pb-active-slide .et_pb_slide_image' ); $slide_video_container = $this_slider.find( '.et-pb-active-slide .et_pb_slide_video' ); $slide = $slide_image_container.closest( '.et_pb_slide' ), $slider = $slide.closest( '.et_pb_slider' ), slide_height = $slider.innerHeight(), image_height = parseInt( slide_height * 0.8 ), $top_header = $('#top-header'), $main_header = $('#main-header'), $et_transparent_nav = $( '.et_transparent_nav' ), $et_vertical_nav = $('.et_vertical_nav'); $slide_image_container.find( 'img' ).css( 'maxHeight', image_height + 'px' ); if ( $slide.hasClass( 'et_pb_media_alignment_center' ) ) { $slide_image_container.css( 'marginTop', '-' + parseInt( $slide_image_container.height() / 2 ) + 'px' ); } $slide_video_container.css( 'marginTop', '-' + parseInt( $slide_video_container.height() / 2 ) + 'px' ); $slide_image_container.find( 'img' ).addClass( 'active' ); } function et_get_bg_layout_color( $slide ) { if ( $slide.hasClass( 'et_pb_bg_layout_light' ) ) { return 'et_pb_bg_layout_light'; } return 'et_pb_bg_layout_dark'; } function et_maybe_set_controls_color( $slide ) { var next_slide_dot_color, $arrows, arrows_color; if ( typeof $et_slider_controls !== 'undefined' && $et_slider_controls.length ) { next_slide_dot_color = $slide.attr( 'data-dots_color' ) || ''; if ( next_slide_dot_color !== '' ) { $et_slider_controls.attr( 'style', 'background-color: ' + hex_to_rgba( next_slide_dot_color, '0.3' ) + ';' ) $et_slider_controls.filter( '.et-pb-active-control' ).attr( 'style', 'background-color: ' + hex_to_rgba( next_slide_dot_color ) + '!important;' ); } else { $et_slider_controls.removeAttr( 'style' ); } } if ( typeof $et_slider_arrows !== 'undefined' && $et_slider_arrows.length ) { $arrows = $et_slider_arrows.find( 'a' ); arrows_color = $slide.attr( 'data-arrows_color' ) || ''; if ( arrows_color !== '' ) { $arrows.css( 'color', arrows_color ); } else { $arrows.css( 'color', 'inherit' ); } } } // fix the appearance of some modules inside the post slider function et_fix_builder_content() { if ( is_post_slider ) { setTimeout( function() { var $et_pb_circle_counter = $( '.et_pb_circle_counter' ), $et_pb_number_counter = $( '.et_pb_number_counter' ); window.et_fix_testimonial_inner_width(); if ( $et_pb_circle_counter.length ) { window.et_pb_reinit_circle_counters( $et_pb_circle_counter ); } if ( $et_pb_number_counter.length ) { window.et_pb_reinit_number_counters( $et_pb_number_counter ); } window.et_reinit_waypoint_modules(); }, 1000 ); } } function hex_to_rgba( color, alpha ) { var color_16 = parseInt( color.replace( '#', '' ), 16 ), red = ( color_16 >> 16 ) & 255, green = ( color_16 >> 8 ) & 255, blue = color_16 & 255, alpha = alpha || 1, rgba; rgba = red + ',' + green + ',' + blue + ',' + alpha; rgba = 'rgba(' + rgba + ')'; return rgba; } if ( window.et_load_event_fired ) { et_fix_slider_content_images(); } else { $et_window.load( function() { et_fix_slider_content_images(); } ); } $et_window.resize( function() { et_fix_slider_content_images(); } ); $et_slider.et_slider_move_to = function ( direction ) { var $active_slide = $et_slide.eq( et_active_slide ), $next_slide; $et_slider.et_animation_running = true; $et_slider.removeClass('et_slide_transition_to_next et_slide_transition_to_previous').addClass('et_slide_transition_to_' + direction ); $et_slider.find('.et-pb-moved-slide').removeClass('et-pb-moved-slide'); if ( direction == 'next' || direction == 'previous' ){ if ( direction == 'next' ) et_active_slide = ( et_active_slide + 1 ) < et_slides_number ? et_active_slide + 1 : 0; else et_active_slide = ( et_active_slide - 1 ) >= 0 ? et_active_slide - 1 : et_slides_number - 1; } else { if ( et_active_slide == direction ) { $et_slider.et_animation_running = false; return; } et_active_slide = direction; } if ( typeof et_slider_timer != 'undefined' ) clearInterval( et_slider_timer ); $next_slide = $et_slide.eq( et_active_slide ); if ( typeof $active_slide.find('video')[0] !== 'undefined' && typeof $active_slide.find('video')[0]['player'] !== 'undefined' ) { $active_slide.find('video')[0].player.pause(); } if ( typeof $next_slide.find('video')[0] !== 'undefined' && typeof $next_slide.find('video')[0]['player'] !== 'undefined' ) { $next_slide.find('video')[0].player.play(); } $et_slider.trigger( 'simple_slider_before_move_to', { direction : direction, next_slide : $next_slide }); $et_slide.each( function(){ $(this).css( 'zIndex', 1 ); } ); $active_slide.css( 'zIndex', 2 ).removeClass( 'et-pb-active-slide' ).addClass('et-pb-moved-slide'); $next_slide.css( { 'display' : 'block', opacity : 0 } ).addClass( 'et-pb-active-slide' ); et_fix_slider_content_images(); et_fix_builder_content(); if ( settings.use_controls ) $et_slider_controls.removeClass( settings.control_active_class ).eq( et_active_slide ).addClass( settings.control_active_class ); if ( settings.use_carousel ) $et_slider_carousel_controls.removeClass( settings.control_active_class ).eq( et_active_slide ).addClass( settings.control_active_class ); if ( ! settings.tabs_animation ) { et_maybe_set_controls_color( $next_slide ); $next_slide.animate( { opacity : 1 }, et_fade_speed ); $active_slide.addClass( 'et_slide_transition' ).css( { 'display' : 'list-item', 'opacity' : 1 } ).animate( { opacity : 0 }, et_fade_speed, function(){ var active_slide_layout_bg_color = et_get_bg_layout_color( $active_slide ), next_slide_layout_bg_color = et_get_bg_layout_color( $next_slide ); $(this).css('display', 'none').removeClass( 'et_slide_transition' ); et_stop_video( $active_slide ); $et_slider .removeClass( active_slide_layout_bg_color ) .addClass( next_slide_layout_bg_color ); $et_slider.et_animation_running = false; $et_slider.trigger( 'simple_slider_after_move_to', { next_slide : $next_slide } ); } ); } else { $next_slide.css( { 'display' : 'none', opacity : 0 } ); $active_slide.addClass( 'et_slide_transition' ).css( { 'display' : 'block', 'opacity' : 1 } ).animate( { opacity : 0 }, et_fade_speed, function(){ $(this).css('display', 'none').removeClass( 'et_slide_transition' ); $next_slide.css( { 'display' : 'block', 'opacity' : 0 } ).animate( { opacity : 1 }, et_fade_speed, function() { $et_slider.et_animation_running = false; $et_slider.trigger( 'simple_slider_after_move_to', { next_slide : $next_slide } ); } ); } ); } if ( $next_slide.find( '.et_parallax_bg' ).length ) { // reinit parallax on slide change to make sure it displayed correctly window.et_pb_parallax_init( $next_slide.find( '.et_parallax_bg' ) ); } et_slider_auto_rotate(); } } $.fn.et_pb_simple_slider = function( options ) { return this.each(function() { new $.et_pb_simple_slider(this, options); }); } var et_hash_module_seperator = '||', et_hash_module_param_seperator = '|'; function process_et_hashchange( hash ) { if ( ( hash.indexOf( et_hash_module_seperator, 0 ) ) !== -1 ) { modules = hash.split( et_hash_module_seperator ); for ( var i = 0; i < modules.length; i++ ) { var module_params = modules[i].split( et_hash_module_param_seperator ); var element = module_params[0]; module_params.shift(); if ( $('#' + element ).length ) { $('#' + element ).trigger({ type: "et_hashchange", params: module_params }); } } } else { module_params = hash.split( et_hash_module_param_seperator ); var element = module_params[0]; module_params.shift(); if ( $('#' + element ).length ) { $('#' + element ).trigger({ type: "et_hashchange", params: module_params }); } } } function et_set_hash( module_state_hash ) { module_id = module_state_hash.split( et_hash_module_param_seperator )[0]; if ( !$('#' + module_id ).length ) { return; } if ( window.location.hash ) { var hash = window.location.hash.substring(1), //Puts hash in variable, and removes the # character new_hash = []; if ( ( hash.indexOf( et_hash_module_seperator, 0 ) ) !== -1 ) { modules = hash.split( et_hash_module_seperator ); var in_hash = false; for ( var i = 0; i < modules.length; i++ ) { var element = modules[i].split( et_hash_module_param_seperator )[0]; if ( element === module_id ) { new_hash.push( module_state_hash ); in_hash = true; } else { new_hash.push( modules[i] ); } } if ( !in_hash ) { new_hash.push( module_state_hash ); } } else { module_params = hash.split( et_hash_module_param_seperator ); var element = module_params[0]; if ( element !== module_id ) { new_hash.push( hash ); } new_hash.push( module_state_hash ); } hash = new_hash.join( et_hash_module_seperator ); } else { hash = module_state_hash; } var yScroll = document.body.scrollTop; window.location.hash = hash; document.body.scrollTop = yScroll; } $.et_pb_simple_carousel = function(el, options) { var settings = $.extend( { slide_duration : 500, }, options ); var $et_carousel = $(el), $carousel_items = $et_carousel.find('.et_pb_carousel_items'), $the_carousel_items = $carousel_items.find('.et_pb_carousel_item'); $et_carousel.et_animation_running = false; $et_carousel.addClass('container-width-change-notify').on('containerWidthChanged', function( event ){ set_carousel_columns( $et_carousel ); set_carousel_height( $et_carousel ); }); $carousel_items.data('items', $the_carousel_items.toArray() ); $et_carousel.data('columns_setting_up', false ); $carousel_items.prepend('
' + '' + et_pb_custom.previous + '' + '' + '' + et_pb_custom.next + '' + '
'); set_carousel_columns( $et_carousel ); set_carousel_height( $et_carousel ); $et_carousel_next = $et_carousel.find( '.et-pb-arrow-next' ); $et_carousel_prev = $et_carousel.find( '.et-pb-arrow-prev' ); $et_carousel.on( 'click', '.et-pb-arrow-next', function(){ if ( $et_carousel.et_animation_running ) return false; $et_carousel.et_carousel_move_to( 'next' ); return false; } ); $et_carousel.on( 'click', '.et-pb-arrow-prev', function(){ if ( $et_carousel.et_animation_running ) return false; $et_carousel.et_carousel_move_to( 'previous' ); return false; } ); // swipe support requires et-jquery-touch-mobile $et_carousel.on( 'swipeleft', function() { $et_carousel.et_carousel_move_to( 'next' ); }); $et_carousel.on( 'swiperight', function() { $et_carousel.et_carousel_move_to( 'previous' ); }); function set_carousel_height( $the_carousel ) { var carousel_items_width = $the_carousel_items.width(), carousel_items_height = $the_carousel_items.height(); $carousel_items.css('height', carousel_items_height + 'px' ); } function set_carousel_columns( $the_carousel ) { var columns, $carousel_parent = $the_carousel.parents('.et_pb_column'), carousel_items_width = $carousel_items.width(), carousel_item_count = $the_carousel_items.length; if ( $carousel_parent.hasClass('et_pb_column_4_4') || $carousel_parent.hasClass('et_pb_column_3_4') || $carousel_parent.hasClass('et_pb_column_2_3') ) { if ( $et_window.width() < 768 ) { columns = 3; } else { columns = 4; } } else if ( $carousel_parent.hasClass('et_pb_column_1_2') || $carousel_parent.hasClass('et_pb_column_3_8') || $carousel_parent.hasClass('et_pb_column_1_3') ) { columns = 3; } else if ( $carousel_parent.hasClass('et_pb_column_1_4') ) { if ( $et_window.width() > 480 && $et_window.width() < 980 ) { columns = 3; } else { columns = 2; } } if ( columns === $carousel_items.data('portfolio-columns') ) { return; } if ( $the_carousel.data('columns_setting_up') ) { return; } $the_carousel.data('columns_setting_up', true ); // store last setup column $carousel_items.removeClass('columns-' + $carousel_items.data('portfolio-columns') ); $carousel_items.addClass('columns-' + columns ); $carousel_items.data('portfolio-columns', columns ); // kill all previous groups to get ready to re-group if ( $carousel_items.find('.et-carousel-group').length ) { $the_carousel_items.appendTo( $carousel_items ); $carousel_items.find('.et-carousel-group').remove(); } // setup the grouping var the_carousel_items = $carousel_items.data('items'), $carousel_group = $('