').insertAfter( $active_carousel_group );
$next_carousel_group.css({ 'width': $active_carousel_group.innerWidth() }).show();
// this is an endless loop, so it can decide internally when to break out, so that next_position
// can get filled up, even to the extent of an element having both and current_ and next_ position
for( x = 0, total = 0 ; ; x++, total++ ) {
if ( total >= active_items_start && total < active_items_end ) {
$( items[x] ).addClass( 'changing_position current_position current_position_' + current_position );
$( items[x] ).data('current_position', current_position );
current_position++;
}
if ( total >= next_items_start && total < next_items_end ) {
$( items[x] ).data('next_position', next_position );
$( items[x] ).addClass('changing_position next_position next_position_' + next_position );
if ( !$( items[x] ).hasClass( 'current_position' ) ) {
$( items[x] ).addClass('container_append');
} else {
$( items[x] ).clone(true).appendTo( $active_carousel_group ).hide().addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' );
$( items[x] ).addClass('delayed_container_append');
}
next_position++;
}
if ( next_position > columns ) {
break;
}
if ( x >= ( items.length -1 )) {
x = -1;
}
}
sorted = $portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) {
var el_a_position = parseInt( $(a).data('next_position') );
var el_b_position = parseInt( $(b).data('next_position') );
return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0;
});
$( sorted ).show().appendTo( $next_carousel_group );
$next_carousel_group.children().each(function(){
$(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('next_position') - 1 ) ) });
});
$active_carousel_group.animate({
left: '-100%'
}, {
duration: slide_duration,
complete: function() {
$portfolio_items.find('.delayed_container_append').each(function(){
$(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('next_position') - 1 ) ) });
$(this).appendTo( $next_carousel_group );
});
$active_carousel_group.removeClass('active');
$active_carousel_group.children().each(function(){
position = $(this).data('position');
current_position = $(this).data('current_position');
$(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position );
$(this).data('position', '');
$(this).data('current_position', '');
$(this).hide();
$(this).css({'position': '', 'width': '', 'left': ''});
$(this).appendTo( $portfolio_items );
});
$active_carousel_group.remove();
et_carousel_auto_rotate( $the_portfolio );
}
} );
$next_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '100%'});
$next_carousel_group.animate({
left: '0%'
}, {
duration: slide_duration,
complete: function(){
setTimeout(function(){
$next_carousel_group.removeClass('next').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''});
$next_carousel_group.find('.delayed_container_append_dup').remove();
$next_carousel_group.find('.changing_position').each(function( index ){
position = $(this).data('position');
current_position = $(this).data('current_position');
next_position = $(this).data('next_position');
$(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' next_position next_position_' + next_position );
$(this).data('current_position', '');
$(this).data('next_position', '');
$(this).data('position', ( index + 1 ) );
});
$next_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''});
$the_portfolio.data('carouseling', false);
}, 100 );
}
} );
} else {
var $prev_carousel_group,
current_position = columns,
prev_position = columns,
columns_span = columns - 1,
active_items_start = items.indexOf( $active_carousel_group.children().last()[0] ),
active_items_end = active_items_start - columns_span,
prev_items_start = active_items_end - 1,
prev_items_end = prev_items_start - columns_span;
$prev_carousel_group = $('
').insertBefore( $active_carousel_group );
$prev_carousel_group.css({ 'left': '-' + $active_carousel_group.innerWidth(), 'width': $active_carousel_group.innerWidth() }).show();
// this is an endless loop, so it can decide internally when to break out, so that next_position
// can get filled up, even to the extent of an element having both and current_ and next_ position
for( x = ( items.length - 1 ), total = ( items.length - 1 ) ; ; x--, total-- ) {
if ( total <= active_items_start && total >= active_items_end ) {
$( items[x] ).addClass( 'changing_position current_position current_position_' + current_position );
$( items[x] ).data('current_position', current_position );
current_position--;
}
if ( total <= prev_items_start && total >= prev_items_end ) {
$( items[x] ).data('prev_position', prev_position );
$( items[x] ).addClass('changing_position prev_position prev_position_' + prev_position );
if ( !$( items[x] ).hasClass( 'current_position' ) ) {
$( items[x] ).addClass('container_append');
} else {
$( items[x] ).clone(true).appendTo( $active_carousel_group ).addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' );
$( items[x] ).addClass('delayed_container_append');
}
prev_position--;
}
if ( prev_position <= 0 ) {
break;
}
if ( x == 0 ) {
x = items.length;
}
}
sorted = $portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) {
var el_a_position = parseInt( $(a).data('prev_position') );
var el_b_position = parseInt( $(b).data('prev_position') );
return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0;
});
$( sorted ).show().appendTo( $prev_carousel_group );
$prev_carousel_group.children().each(function(){
$(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('prev_position') - 1 ) ) });
});
$active_carousel_group.animate({
left: '100%'
}, {
duration: slide_duration,
complete: function() {
$portfolio_items.find('.delayed_container_append').reverse().each(function(){
$(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('prev_position') - 1 ) ) });
$(this).prependTo( $prev_carousel_group );
});
$active_carousel_group.removeClass('active');
$active_carousel_group.children().each(function(){
position = $(this).data('position');
current_position = $(this).data('current_position');
$(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position );
$(this).data('position', '');
$(this).data('current_position', '');
$(this).hide();
$(this).css({'position': '', 'width': '', 'left': ''});
$(this).appendTo( $portfolio_items );
});
$active_carousel_group.remove();
}
} );
$prev_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '-100%'});
$prev_carousel_group.animate({
left: '0%'
}, {
duration: slide_duration,
complete: function(){
setTimeout(function(){
$prev_carousel_group.removeClass('prev').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''});
$prev_carousel_group.find('.delayed_container_append_dup').remove();
$prev_carousel_group.find('.changing_position').each(function( index ){
position = $(this).data('position');
current_position = $(this).data('current_position');
prev_position = $(this).data('prev_position');
$(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' prev_position prev_position_' + prev_position );
$(this).data('current_position', '');
$(this).data('prev_position', '');
position = index + 1;
$(this).data('position', position );
$(this).addClass('position_' + position );
});
$prev_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''});
$the_portfolio.data('carouseling', false);
}, 100 );
}
} );
}
return false;
});
} else {
// setup fullwidth portfolio grid
set_fullwidth_portfolio_columns( $the_portfolio, false );
}
});
}
if ( $et_pb_filterable_portfolio.length ) {
$(window).load(function(){
$et_pb_filterable_portfolio.each(function(){
var $the_portfolio = $(this),
$the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'),
$left_orientatation = true == $the_portfolio.data( 'rtl' ) ? false : true;
$the_portfolio.show();
set_filterable_grid_items( $the_portfolio );
$the_portfolio.on('click', '.et_pb_portfolio_filter a', function(e){
e.preventDefault();
var category_slug = $(this).data('category-slug');
$the_portfolio_items = $(this).parents('.et_pb_filterable_portfolio').find('.et_pb_portfolio_items');
if ( 'all' == category_slug ) {
$the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active');
$the_portfolio.find('.et_pb_portfolio_filter_all a').addClass('active');
$the_portfolio.find('.et_pb_portfolio_item').removeClass('active inactive');
$the_portfolio.find('.et_pb_portfolio_item').show();
$the_portfolio.find('.et_pb_portfolio_item').addClass('active');
} else {
$the_portfolio.find('.et_pb_portfolio_filter_all').removeClass('active');
$the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active');
$the_portfolio.find('.et_pb_portfolio_filter_all a').removeClass('active');
$(this).addClass('active');
$the_portfolio_items.find('.et_pb_portfolio_item').hide();
$the_portfolio_items.find('.et_pb_portfolio_item').addClass( 'inactive' );
$the_portfolio_items.find('.et_pb_portfolio_item').removeClass('active');
$the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).show();
$the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).addClass('active').removeClass( 'inactive' );
}
set_filterable_grid_items( $the_portfolio );
setTimeout(function(){
set_filterable_portfolio_hash( $the_portfolio );
}, 500 );
});
$(this).on('et_hashchange', function( event ){
var params = event.params;
$the_portfolio = $( '#' + event.target.id );
if ( !$the_portfolio.find('.et_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').hasClass('active') ) {
$the_portfolio.find('.et_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').click();
}
if ( params[1] ) {
setTimeout(function(){
if ( !$the_portfolio.find('.et_pb_portofolio_pagination a.page-' + params[1]).hasClass('active') ) {
$the_portfolio.find('.et_pb_portofolio_pagination a.page-' + params[1]).addClass('active').click();
}
}, 300 );
}
});
});
}); // End $(window).load()
function set_filterable_grid_items( $the_portfolio ) {
var active_category = $the_portfolio.find('.et_pb_portfolio_filter > a.active').data('category-slug'),
container_width = $the_portfolio.find( '.et_pb_portfolio_items' ).innerWidth(),
item_width = $the_portfolio.find( '.et_pb_portfolio_item' ).outerWidth( true ),
last_item_margin = item_width - $the_portfolio.find( '.et_pb_portfolio_item' ).outerWidth(),
columns_count = Math.round( ( container_width + last_item_margin ) / item_width ),
counter = 1,
first_in_row = 1
$the_portfolio.find( '.et_pb_portfolio_item' ).removeClass( 'last_in_row first_in_row' );
$the_portfolio.find( '.et_pb_portfolio_item' ).each( function() {
var $this_el = $( this );
if ( ! $this_el.hasClass( 'inactive' ) ) {
if ( first_in_row === counter ) {
$this_el.addClass( 'first_in_row' );
}
if ( 0 === counter % columns_count ) {
$this_el.addClass( 'last_in_row' );
first_in_row = counter + 1;
}
counter++;
}
});
if ( 'all' === active_category ) {
$the_portfolio_visible_items = $the_portfolio.find('.et_pb_portfolio_item');
} else {
$the_portfolio_visible_items = $the_portfolio.find('.et_pb_portfolio_item.project_category_' + active_category);
}
var visible_grid_items = $the_portfolio_visible_items.length,
posts_number = $the_portfolio.data('posts-number'),
pages = Math.ceil( visible_grid_items / posts_number );
set_filterable_grid_pages( $the_portfolio, pages );
var visible_grid_items = 0;
var _page = 1;
$the_portfolio.find('.et_pb_portfolio_item').data('page', '');
$the_portfolio_visible_items.each(function(i){
visible_grid_items++;
if ( 0 === parseInt( visible_grid_items % posts_number ) ) {
$(this).data('page', _page);
_page++;
} else {
$(this).data('page', _page);
}
});
$the_portfolio_visible_items.filter(function() {
return $(this).data('page') == 1;
}).show();
$the_portfolio_visible_items.filter(function() {
return $(this).data('page') != 1;
}).hide();
}
function set_filterable_grid_pages( $the_portfolio, pages ) {
$pagination = $the_portfolio.find('.et_pb_portofolio_pagination');
if ( !$pagination.length ) {
return;
}
$pagination.html('
');
if ( pages <= 1 ) {
return;
}
$pagination_list = $pagination.children('ul');
$pagination_list.append('
' + et_custom.prev + '');
for( var page = 1; page <= pages; page++ ) {
var first_page_class = page === 1 ? ' active' : '',
last_page_class = page === pages ? ' last-page' : '',
hidden_page_class = page >= 5 ? ' style="display:none;"' : '';
$pagination_list.append('
' + page + '');
}
$pagination_list.append('
' + et_custom.next + '');
}
$et_pb_filterable_portfolio.on('click', '.et_pb_portofolio_pagination a', function(e){
e.preventDefault();
var to_page = $(this).data('page'),
$the_portfolio = $(this).parents('.et_pb_filterable_portfolio'),
$the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items');
et_pb_smooth_scroll( $the_portfolio, false, 800 );
if ( $(this).hasClass('page-prev') ) {
to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) - 1;
} else if ( $(this).hasClass('page-next') ) {
to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) + 1;
}
$(this).parents('ul').find('a').removeClass('active');
$(this).parents('ul').find('a.page-' + to_page ).addClass('active');
var current_index = $(this).parents('ul').find('a.page-' + to_page ).parent().index(),
total_pages = $(this).parents('ul').find('li.page').length;
$(this).parent().nextUntil('.page-' + ( current_index + 3 ) ).show();
$(this).parent().prevUntil('.page-' + ( current_index - 3 ) ).show();
$(this).parents('ul').find('li.page').each(function(i){
if ( !$(this).hasClass('prev') && !$(this).hasClass('next') ) {
if ( i < ( current_index - 3 ) ) {
$(this).hide();
} else if ( i > ( current_index + 1 ) ) {
$(this).hide();
} else {
$(this).show();
}
if ( total_pages - current_index <= 2 && total_pages - i <= 5 ) {
$(this).show();
} else if ( current_index <= 3 && i <= 4 ) {
$(this).show();
}
}
});
if ( to_page > 1 ) {
$(this).parents('ul').find('li.prev').show();
} else {
$(this).parents('ul').find('li.prev').hide();
}
if ( $(this).parents('ul').find('a.active').hasClass('last-page') ) {
$(this).parents('ul').find('li.next').hide();
} else {
$(this).parents('ul').find('li.next').show();
}
$the_portfolio.find('.et_pb_portfolio_item').hide();
$the_portfolio.find('.et_pb_portfolio_item').filter(function( index ) {
return $(this).data('page') === to_page;
}).show();
setTimeout(function(){
set_filterable_portfolio_hash( $the_portfolio );
}, 500 );
});
function set_filterable_portfolio_hash( $the_portfolio ) {
if ( !$the_portfolio.attr('id') ) {
return;
}
var this_portfolio_state = [];
this_portfolio_state.push( $the_portfolio.attr('id') );
this_portfolio_state.push( $the_portfolio.find('.et_pb_portfolio_filter > a.active').data('category-slug') );
if ( $the_portfolio.find('.et_pb_portofolio_pagination a.active').length ) {
this_portfolio_state.push( $the_portfolio.find('.et_pb_portofolio_pagination a.active').data('page') );
} else {
this_portfolio_state.push( 1 );
}
this_portfolio_state = this_portfolio_state.join( et_hash_module_param_seperator );
et_set_hash( this_portfolio_state );
}
} /* end if ( $et_pb_filterable_portfolio.length ) */
if ( $et_pb_gallery.length ) {
function set_gallery_grid_items( $the_gallery ) {
var $the_gallery_items_container = $the_gallery.find('.et_pb_gallery_items'),
$the_gallery_items = $the_gallery_items_container.find('.et_pb_gallery_item');
var total_grid_items = $the_gallery_items.length,
posts_number = $the_gallery_items_container.data('per_page'),
pages = Math.ceil( total_grid_items / posts_number );
set_gallery_grid_pages( $the_gallery, pages );
var total_grid_items = 0;
var _page = 1;
$the_gallery_items.data('page', '');
$the_gallery_items.each(function(i){
total_grid_items++;
if ( 0 === parseInt( total_grid_items % posts_number ) ) {
$(this).data('page', _page);
_page++;
} else {
$(this).data('page', _page);
}
});
var visible_items = $the_gallery_items.filter(function() {
return $(this).data('page') == 1;
}).show();
$the_gallery_items.filter(function() {
return $(this).data('page') != 1;
}).hide();
}
function set_gallery_grid_pages( $the_gallery, pages ) {
$pagination = $the_gallery.find('.et_pb_gallery_pagination');
if ( !$pagination.length ) {
return;
}
$pagination.html('
');
if ( pages <= 1 ) {
$pagination.hide();
return;
}
$pagination_list = $pagination.children('ul');
$pagination_list.append('
' + et_custom.prev + '');
for( var page = 1; page <= pages; page++ ) {
var first_page_class = page === 1 ? ' active' : '',
last_page_class = page === pages ? ' last-page' : '',
hidden_page_class = page >= 5 ? ' style="display:none;"' : '';
$pagination_list.append('
' + page + '');
}
$pagination_list.append('
' + et_custom.next + '');
}
function set_gallery_hash( $the_gallery ) {
if ( !$the_gallery.attr('id') ) {
return;
}
var this_gallery_state = [];
this_gallery_state.push( $the_gallery.attr('id') );
if ( $the_gallery.find('.et_pb_gallery_pagination a.active').length ) {
this_gallery_state.push( $the_gallery.find('.et_pb_gallery_pagination a.active').data('page') );
} else {
this_gallery_state.push( 1 );
}
this_gallery_state = this_gallery_state.join( et_hash_module_param_seperator );
et_set_hash( this_gallery_state );
}
$et_pb_gallery.each(function(){
var $the_gallery = $(this);
if ( $the_gallery.hasClass( 'et_pb_gallery_grid' ) ) {
$the_gallery.show();
set_gallery_grid_items( $the_gallery );
$the_gallery.on('et_hashchange', function( event ){
var params = event.params;
$the_gallery = $( '#' + event.target.id );
if ( page_to = params[0] ) {
setTimeout(function(){
if ( !$the_gallery.find('.et_pb_gallery_pagination a.page-' + page_to ).hasClass('active') ) {
$the_gallery.find('.et_pb_gallery_pagination a.page-' + page_to ).addClass('active').click();
}
}, 300 );
}
});
}
});
$et_pb_gallery.data('paginating', false );
$et_pb_gallery.on('click', '.et_pb_gallery_pagination a', function(e){
e.preventDefault();
var to_page = $(this).data('page'),
$the_gallery = $(this).parents('.et_pb_gallery'),
$the_gallery_items_container = $the_gallery.find('.et_pb_gallery_items'),
$the_gallery_items = $the_gallery_items_container.find('.et_pb_gallery_item');
if ( $the_gallery.data('paginating') ) {
return;
}
$the_gallery.data('paginating', true );
if ( $(this).hasClass('page-prev') ) {
to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) - 1;
} else if ( $(this).hasClass('page-next') ) {
to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) + 1;
}
$(this).parents('ul').find('a').removeClass('active');
$(this).parents('ul').find('a.page-' + to_page ).addClass('active');
var current_index = $(this).parents('ul').find('a.page-' + to_page ).parent().index(),
total_pages = $(this).parents('ul').find('li.page').length;
$(this).parent().nextUntil('.page-' + ( current_index + 3 ) ).show();
$(this).parent().prevUntil('.page-' + ( current_index - 3 ) ).show();
$(this).parents('ul').find('li.page').each(function(i){
if ( !$(this).hasClass('prev') && !$(this).hasClass('next') ) {
if ( i < ( current_index - 3 ) ) {
$(this).hide();
} else if ( i > ( current_index + 1 ) ) {
$(this).hide();
} else {
$(this).show();
}
if ( total_pages - current_index <= 2 && total_pages - i <= 5 ) {
$(this).show();
} else if ( current_index <= 3 && i <= 4 ) {
$(this).show();
}
}
});
if ( to_page > 1 ) {
$(this).parents('ul').find('li.prev').show();
} else {
$(this).parents('ul').find('li.prev').hide();
}
if ( $(this).parents('ul').find('a.active').hasClass('last-page') ) {
$(this).parents('ul').find('li.next').hide();
} else {
$(this).parents('ul').find('li.next').show();
}
$the_gallery_items.hide();
var visible_items = $the_gallery_items.filter(function( index ) {
return $(this).data('page') === to_page;
}).show();
$the_gallery.data('paginating', false );
setTimeout(function(){
set_gallery_hash( $the_gallery );
}, 100 );
$( 'html, body' ).animate( { scrollTop : $the_gallery.offset().top - 200 }, 200 );
});
} /* end if ( $et_pb_gallery.length ) */
function et_countdown_timer( timer ) {
var gmt_offset = timer.data('gmt-offset') * 3600000;
var end_date = new Date( timer.data('end-date') ).getTime();
end_date = end_date + gmt_offset;
var current_date = new Date(),
month_names = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
current_date = ( month_names[current_date.getMonth()] ) + ' ' + current_date.getDate() + ' ' + current_date.getFullYear() + ' ' + current_date.getHours() + ':' + current_date.getMinutes() + ':' + current_date.getSeconds();
current_date = new Date( current_date ).getTime() + gmt_offset;
var seconds_left = ( end_date - current_date ) / 1000;
days = parseInt(seconds_left / 86400);
days = days > 0 ? days : 0;
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
hours = hours > 0 ? hours : 0;
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
minutes = minutes > 0 ? minutes : 0;
seconds = parseInt(seconds_left % 60);
seconds = seconds > 0 ? seconds : 0;
if ( days == 0 ) {
if ( !timer.find('.days > .value').parent('.section').hasClass('zero') ) {
timer.find('.days > .value').html( '000' ).parent('.section').addClass('zero').next().addClass('zero');
}
} else {
days_slice = days.toString().length >= 3 ? days.toString().length : 3;
timer.find('.days > .value').html( ('000' + days).slice(-days_slice) );
}
if ( days == 0 && hours == 0 ) {
if ( !timer.find('.hours > .value').parent('.section').hasClass('zero') ) {
timer.find('.hours > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
}
} else {
timer.find('.hours > .value').html( ( '0' + hours ).slice(-2) );
}
if ( days == 0 && hours == 0 && minutes == 0 ) {
if ( !timer.find('.minutes > .value').parent('.section').hasClass('zero') ) {
timer.find('.minutes > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
}
} else {
timer.find('.minutes > .value').html( ( '0' + minutes ).slice(-2) );
}
if ( days == 0 && hours == 0 && minutes == 0 && seconds == 0 ) {
if ( !timer.find('.seconds > .value').parent('.section').hasClass('zero') ) {
timer.find('.seconds > .value').html('00').parent('.section').addClass('zero');
}
} else {
timer.find('.seconds > .value').html( ( '0' + seconds ).slice(-2) );
}
}
function et_countdown_timer_labels( timer ) {
if ( timer.closest( '.et_pb_column_3_8' ).length || timer.children('.et_pb_countdown_timer_container').width() <= 250 ) {
timer.find('.hours .label').html( timer.find('.hours').data('short') );
timer.find('.minutes .label').html( timer.find('.minutes').data('short') );
timer.find('.seconds .label').html( timer.find('.seconds').data('short') );
}
}
if ( $et_pb_countdown_timer.length ) {
$et_pb_countdown_timer.each(function(){
var timer = $(this);
et_countdown_timer_labels( timer );
et_countdown_timer( timer );
setInterval(function(){
et_countdown_timer( timer );
}, 1000);
});
}
if ( $et_pb_tabs.length ) {
$et_pb_tabs.et_pb_simple_slider( {
use_controls : false,
use_arrows : false,
slide : '.et_pb_all_tabs > div',
tabs_animation : true
} ).on('et_hashchange', function( event ){
var params = event.params;
var $the_tabs = $( '#' + event.target.id );
var active_tab = params[0];
if ( !$the_tabs.find( '.et_pb_tabs_controls li' ).eq( active_tab ).hasClass('et_pb_tab_active') ) {
$the_tabs.find( '.et_pb_tabs_controls li' ).eq( active_tab ).click();
}
});
$et_pb_tabs_li.click( function() {
var $this_el = $(this),
$tabs_container = $this_el.closest( '.et_pb_tabs' ).data('et_pb_simple_slider');
if ( $tabs_container.et_animation_running ) return false;
$this_el.addClass( 'et_pb_tab_active' ).siblings().removeClass( 'et_pb_tab_active' );
$tabs_container.data('et_pb_simple_slider').et_slider_move_to( $this_el.index() );
if ( $this_el.closest( '.et_pb_tabs' ).attr('id') ) {
var tab_state = [];
tab_state.push( $this_el.closest( '.et_pb_tabs' ).attr('id') );
tab_state.push( $this_el.index() );
tab_state = tab_state.join( et_hash_module_param_seperator );
et_set_hash( tab_state );
}
return false;
} );
}
if ( $et_pb_map.length ) {
google.maps.event.addDomListener(window, 'load', function() {
$et_pb_map.each(function(){
var $this_map_container = $(this),
$this_map = $this_map_container.children('.et_pb_map'),
this_map_grayscale = $this_map_container.data( 'grayscale' ) || 0;
if ( this_map_grayscale !== 0 ) {
this_map_grayscale = '-' + this_map_grayscale.toString();
}
$this_map_container.data('map', new google.maps.Map( $this_map[0], {
zoom: parseInt( $this_map.data('zoom') ),
center: new google.maps.LatLng( parseFloat( $this_map.data('center-lat') ) , parseFloat( $this_map.data('center-lng') )),
mapTypeId: google.maps.MapTypeId.ROADMAP,
scrollwheel: $this_map.data('mouse-wheel') == 'on' ? true : false,
panControlOptions: {
position: $this_map_container.is( '.et_beneath_transparent_nav' ) ? google.maps.ControlPosition.LEFT_BOTTOM : google.maps.ControlPosition.LEFT_TOP
},
zoomControlOptions: {
position: $this_map_container.is( '.et_beneath_transparent_nav' ) ? google.maps.ControlPosition.LEFT_BOTTOM : google.maps.ControlPosition.LEFT_TOP
},
styles: [ {
stylers: [
{ saturation: parseInt( this_map_grayscale ) }
]
} ]
}));
$this_map_container.data('bounds', new google.maps.LatLngBounds() );
$this_map_container.find('.et_pb_map_pin').each(function(){
var $this_marker = $(this),
position = new google.maps.LatLng( parseFloat( $this_marker.data('lat') ) , parseFloat( $this_marker.data('lng') ) );
$this_map_container.data('bounds').extend( position );
var marker = new google.maps.Marker({
position: position,
map: $this_map_container.data('map'),
title: $this_marker.data('title'),
icon: { url: et_custom.builder_images_uri + '/marker.png', size: new google.maps.Size( 46, 43 ), anchor: new google.maps.Point( 16, 43 ) },
shape: { coord: [1, 1, 46, 43], type: 'rect' },
anchorPoint: new google.maps.Point(0, -45)
});
if ( $this_marker.find('.infowindow').length ) {
var infowindow = new google.maps.InfoWindow({
content: $this_marker.html()
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open( $this_map_container.data('map'), marker );
});
}
});
setTimeout(function(){
if ( !$this_map_container.data('map').getBounds().contains( $this_map_container.data('bounds').getNorthEast() ) || !$this_map_container.data('map').getBounds().contains( $this_map_container.data('bounds').getSouthWest() ) ) {
$this_map_container.data('map').fitBounds( $this_map_container.data('bounds') );
}
}, 200 );
});
} );
}
if ( $et_pb_shop.length ) {
$et_pb_shop.each( function() {
var $this_el = $(this),
icon = $this_el.data('icon') || '';
if ( icon === '' ) {
return true;
}
$this_el.find( '.et_overlay' )
.attr( 'data-icon', icon )
.addClass( 'et_pb_inline_icon' );
} );
}
if ( $et_pb_circle_counter.length ) {
function et_pb_circle_counter_init($the_counter, animate) {
$the_counter.easyPieChart({
easing: 'easeInOutCirc',
animate: {
duration: 1800,
enabled: true
},
size: $the_counter.width(),
barColor: $the_counter.data( 'bar-bg-color' ),
trackColor: $the_counter.data( 'color' ) || '#000000',
trackAlpha: $the_counter.data( 'alpha' ) || '0.1',
scaleColor: false,
lineWidth: 5,
onStart: function() {
$(this.el).find('.percent p').css({ 'visibility' : 'visible' });
},
onStep: function(from, to, percent) {
$(this.el).find('.percent-value').text( Math.round( parseInt( percent ) ) );
},
onStop: function(from, to) {
$(this.el).find('.percent-value').text( $(this.el).data('number-value') );
}
});
}
$et_pb_circle_counter.each(function(){
var $the_counter = $(this);
et_pb_circle_counter_init($the_counter, false);
$the_counter.on('containerWidthChanged', function( event ){
$the_counter = $( event.target );
$the_counter.find('canvas').remove();
$the_counter.removeData('easyPieChart' );
et_pb_circle_counter_init($the_counter, true);
});
});
}
if ( $et_pb_number_counter.length ) {
$et_pb_number_counter.each(function(){
var $this_counter = $(this);
$this_counter.easyPieChart({
easing: 'easeInOutCirc',
animate: {
duration: 1800,
enabled: true
},
size: 0,
trackColor: false,
scaleColor: false,
lineWidth: 0,
onStart: function() {
$(this.el).find('.percent p').css({ 'visibility' : 'visible' });
},
onStep: function(from, to, percent) {
if ( percent != to )
$(this.el).find('.percent-value').text( Math.round( parseInt( percent ) ) );
},
onStop: function(from, to) {
$(this.el).find('.percent-value').text( $(this.el).data('number-value') );
}
});
});
}
function et_apply_parallax() {
var $this = $(this),
element_top = $this.offset().top,
window_top = $et_window.scrollTop(),
y_pos = ( ( ( window_top + $et_window.height() ) - element_top ) * 0.3 ),
main_position;
main_position = 'translate(0, ' + y_pos + 'px)';
$this.find('.et_parallax_bg').css( {
'-webkit-transform' : main_position,
'-moz-transform' : main_position,
'-ms-transform' : main_position,
'transform' : main_position
} );
}
function et_parallax_set_height() {
var $this = $(this),
bg_height;
bg_height = ( $et_window.height() * 0.3 + $this.innerHeight() );
$this.find('.et_parallax_bg').css( { 'height' : bg_height } );
}
$('.et_pb_toggle_title').click( function(){
var $this_heading = $(this),
$module = $this_heading.closest('.et_pb_toggle'),
$section = $module.parents( '.et_pb_section' ),
$content = $module.find('.et_pb_toggle_content'),
$accordion = $module.closest( '.et_pb_accordion' ),
is_accordion = $accordion.length,
is_accordion_toggling = $accordion.hasClass( 'et_pb_accordion_toggling' ),
$accordion_active_toggle;
if ( is_accordion ) {
if ( $module.hasClass('et_pb_toggle_open') || is_accordion_toggling ) {
return false;
}
$accordion.addClass( 'et_pb_accordion_toggling' );
$accordion_active_toggle = $module.siblings('.et_pb_toggle_open');
}
if ( $content.is( ':animated' ) ) {
return;
}
$content.slideToggle( 700, function() {
if ( $module.hasClass('et_pb_toggle_close') ) {
$module.removeClass('et_pb_toggle_close').addClass('et_pb_toggle_open');
} else {
$module.removeClass('et_pb_toggle_open').addClass('et_pb_toggle_close');
}
if ( $section.hasClass( 'et_pb_section_parallax' ) && !$section.children().hasClass( 'et_pb_parallax_css') ) {
$.proxy( et_parallax_set_height, $section )();
}
} );
if ( is_accordion ) {
$accordion_active_toggle.find('.et_pb_toggle_content').slideToggle( 700, function() {
$accordion_active_toggle.removeClass( 'et_pb_toggle_open' ).addClass('et_pb_toggle_close');
$accordion.removeClass( 'et_pb_accordion_toggling' );
} );
}
} );
var $et_contact_container = $('.et_pb_contact_form_container');
if ( $et_contact_container.length ) {
var $et_contact_form = $et_contact_container.find( 'form' ),
$et_contact_submit = $et_contact_container.find( 'input.et_pb_contact_submit' ),
$et_inputs = $et_contact_form.find('input[type=text],textarea'),
et_email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,
et_contact_error = false,
$et_contact_message = $et_contact_container.find('.et-pb-contact-message'),
et_message = '';
$et_inputs.live('focus', function(){
if ( $(this).val() === $(this).siblings('label').text() ) $(this).val("");
}).live('blur', function(){
if ($(this).val() === "") $(this).val( $(this).siblings('label').text() );
});
$et_contact_form.on('submit', function(event) {
et_contact_error = false;
et_message = '
';
$et_inputs.removeClass('et_contact_error');
$et_inputs.each(function(index, domEle){
if ( $(domEle).val() === '' || $(domEle).val() === $(this).siblings('label').text() ) {
$(domEle).addClass('et_contact_error');
et_contact_error = true;
var default_value = $(this).siblings('label').text();
if ( default_value == '' ) default_value = et_custom.captcha;
et_message += '- ' + et_custom.fill + ' ' + default_value + ' ' + et_custom.field + '
';
}
if ( ($(domEle).attr('id') == 'et_contact_email') && !et_email_reg.test($(domEle).val()) ) {
$(domEle).removeClass('et_contact_error').addClass('et_contact_error');
et_contact_error = true;
if ( !et_email_reg.test($(domEle).val()) ) et_message += '- ' + et_custom.invalid + '
';
}
});
if ( !et_contact_error ) {
$href = $(this).attr('action');
$et_contact_container.fadeTo('fast',0.2).load($href + ' #' + $et_contact_form.closest('.et_pb_contact_form_container').attr('id'), $(this).serializeArray(), function() {
$et_contact_container.fadeTo('fast',1);
});
}
et_message += '
';
if ( et_message != '
' )
$et_contact_message.html(et_message);
event.preventDefault();
});
}
$( '.et_pb_video .et_pb_video_overlay, .et_pb_video_wrap .et_pb_video_overlay' ).click( function() {
var $this = $(this),
$video_image = $this.closest( '.et_pb_video_overlay' );
$video_image.fadeTo( 500, 0, function() {
var $image = $(this);
$image.css( 'display', 'none' );
} );
return false;
} );
function et_fix_video_wmode( video_wrapper ) {
$( video_wrapper ).each( function() {
if ( $(this).find( 'iframe' ).length ) {
var $this_el = $(this).find( 'iframe' ),
src_attr = $this_el.attr('src'),
wmode_character = src_attr.indexOf( '?' ) == -1 ? '?' : '&',
this_src = src_attr + wmode_character + 'wmode=opaque';
$this_el.attr('src', this_src);
}
} );
}
function et_pb_resize_section_video_bg( $video ) {
$element = typeof $video !== 'undefined' ? $video.closest( '.et_pb_section_video_bg' ) : $( '.et_pb_section_video_bg' );
$element.each( function() {
var $this_el = $(this),
ratio = ( typeof $this_el.attr( 'data-ratio' ) !== 'undefined' )
? $this_el.attr( 'data-ratio' )
: $this_el.find('video').attr( 'width' ) / $this_el.find('video').attr( 'height' ),
$video_elements = $this_el.find( '.mejs-video, video, object' ).css( 'margin', 0 ),
$container = $this_el.closest( '.et_pb_section_video' ).length
? $this_el.closest( '.et_pb_section_video' )
: $this_el.closest( '.et_pb_slides' ),
body_width = $container.width(),
container_height = $container.innerHeight(),
width, height;
if ( typeof $this_el.attr( 'data-ratio' ) == 'undefined' )
$this_el.attr( 'data-ratio', ratio );
if ( body_width / container_height < ratio ) {
width = container_height * ratio;
height = container_height;
} else {
width = body_width;
height = body_width / ratio;
}
$video_elements.width( width ).height( height );
} );
}
function et_pb_center_video( $video ) {
$element = typeof $video !== 'undefined' ? $video : $( '.et_pb_section_video_bg .mejs-video' );
$element.each( function() {
var $video_width = $(this).width() / 2;
var $video_width_negative = 0 - $video_width;
$(this).css("margin-left",$video_width_negative );
if ( typeof $video !== 'undefined' ) {
if ( $video.closest( '.et_pb_slider' ).length && ! $video.closest( '.et_pb_first_video' ).length )
return false;
}
} );
}
function et_calculate_header_values() {
var $top_header = $( '#top-header' ),
secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0,
admin_bar_height = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).innerHeight() : 0;
et_header_height = $( '#main-header' ).innerHeight() + secondary_nav_height,
et_header_modifier = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56,
et_header_offset = et_header_modifier + admin_bar_height;
et_primary_header_top = secondary_nav_height + admin_bar_height;
}
function et_fix_slider_height() {
if ( ! $et_pb_slider.length ) return;
$et_pb_slider.each( function() {
var $slide_section = $(this).parent( '.et_pb_section' ),
$slide = $(this).find( '.et_pb_slide' ),
$slide_container = $slide.find( '.et_pb_container' ),
max_height = 0;
// If this is appears at the first section benath transparent nav, skip it
// leave it to et_fix_page_container_position()
if ( $slide_section.is( '.et_pb_section_first' ) ){
return true;
}
$slide_container.css( 'min-height', 0 );
$slide.each( function() {
var $this_el = $(this),
height = $this_el.innerHeight();
if ( max_height < height )
max_height = height;
} );
$slide_container.css( 'min-height', max_height );
} );
}
var $comment_form = $('#commentform');
et_pb_form_placeholders_init( $comment_form );
et_pb_form_placeholders_init( $( '.et_pb_newsletter_form' ) );
$comment_form.submit(function(){
et_pb_remove_placeholder_text( $comment_form );
});
function et_pb_form_placeholders_init( $form ) {
$form.find('input:text, textarea').each(function(index,domEle){
var $et_current_input = jQuery(domEle),
$et_comment_label = $et_current_input.siblings('label'),
et_comment_label_value = $et_current_input.siblings('label').text();
if ( $et_comment_label.length ) {
$et_comment_label.hide();
if ( $et_current_input.siblings('span.required') ) {
et_comment_label_value += $et_current_input.siblings('span.required').text();
$et_current_input.siblings('span.required').hide();
}
$et_current_input.val(et_comment_label_value);
}
}).bind('focus',function(){
var et_label_text = jQuery(this).siblings('label').text();
if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text();
if (jQuery(this).val() === et_label_text) jQuery(this).val("");
}).bind('blur',function(){
var et_label_text = jQuery(this).siblings('label').text();
if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text();
if (jQuery(this).val() === "") jQuery(this).val( et_label_text );
});
}
// remove placeholder text before form submission
function et_pb_remove_placeholder_text( $form ) {
$form.find('input:text, textarea').each(function(index,domEle){
var $et_current_input = jQuery(domEle),
$et_label = $et_current_input.siblings('label'),
et_label_value = $et_current_input.siblings('label').text();
if ( $et_label.length && $et_label.is(':hidden') ) {
if ( $et_label.text() == $et_current_input.val() )
$et_current_input.val( '' );
}
});
}
et_duplicate_menu( $('#et-top-navigation ul.nav'), $('#et-top-navigation .mobile_nav'), 'mobile_menu', 'et_mobile_menu' );
$('.et_pb_fullwidth_menu ul.nav').each(function(i) {
i++;
et_duplicate_menu( $(this), $(this).parents('.et_pb_row').find('div .mobile_nav'), 'mobile_menu' + i, 'et_mobile_menu' );
});
$('.et_pb_fullwidth_menu').each(function() {
var this_menu = $( this ),
bg_color = this_menu.data( 'bg_color' );
if ( bg_color ) {
this_menu.find( 'ul' ).css( { 'background-color' : bg_color } );
}
});
function et_duplicate_menu( menu, append_to, menu_id, menu_class ){
append_to.each( function() {
var $this_menu = $(this),
$cloned_nav;
menu.clone().attr('id',menu_id).removeClass().attr('class',menu_class).appendTo( $this_menu );
$cloned_nav = $this_menu.find('> ul');
$cloned_nav.find('.menu_slide').remove();
$cloned_nav.find('li:first').addClass('et_first_mobile_item');
$cloned_nav.find( 'a' ).on( 'click', function(){
$this_menu.trigger( 'click' );
} );
$this_menu.on( 'click', function(){
if ( $(this).hasClass('closed') ){
$(this).removeClass( 'closed' ).addClass( 'opened' );
$cloned_nav.slideDown( 500 );
} else {
$(this).removeClass( 'opened' ).addClass( 'closed' );
$cloned_nav.slideUp( 500 );
}
return false;
} );
$this_menu.on( 'click', 'a', function(event){
event.stopPropagation();
} );
} );
$('#mobile_menu .centered-inline-logo-wrap').remove();
}
if ( $( '#et-secondary-nav' ).length ) {
$('#et-top-navigation #mobile_menu').append( $( '#et-secondary-nav' ).clone().html() );
}
$et_pb_newsletter_button.click( function( event ) {
if ( $(this).closest( '.et_pb_login_form' ).length || $(this).closest( '.et_pb_feedburner_form' ).length ) {
return;
}
event.preventDefault();
var $newsletter_container = $(this).closest( '.et_pb_newsletter' ),
$firstname = $newsletter_container.find( 'input[name="et_pb_signup_firstname"]' ),
$lastname = $newsletter_container.find( 'input[name="et_pb_signup_lastname"]' ),
$email = $newsletter_container.find( 'input[name="et_pb_signup_email"]' ),
list_id = $newsletter_container.find( 'input[name="et_pb_signup_list_id"]' ).val(),
$result = $newsletter_container.find( '.et_pb_newsletter_result' ).hide(),
service = $(this).closest( '.et_pb_newsletter_form' ).data( 'service' ) || 'mailchimp';
$firstname.removeClass( 'et_pb_signup_error' );
$lastname.removeClass( 'et_pb_signup_error' );
$email.removeClass( 'et_pb_signup_error' );
et_pb_remove_placeholder_text( $(this).closest( '.et_pb_newsletter_form' ) );
if ( $firstname.val() == '' || $email.val() == '' || list_id === '' ) {
if ( $firstname.val() == '' ) $firstname.addClass( 'et_pb_signup_error' );
if ( $email.val() == '' ) $email.addClass( 'et_pb_signup_error' );
if ( $firstname.val() == '' )
$firstname.val( $firstname.siblings( '.et_pb_contact_form_label' ).text() );
if ( $lastname.val() == '' )
$lastname.val( $lastname.siblings( '.et_pb_contact_form_label' ).text() );
if ( $email.val() == '' )
$email.val( $email.siblings( '.et_pb_contact_form_label' ).text() );
return;
}
$.ajax( {
type: "POST",
url: et_custom.ajaxurl,
dataType: "json",
data:
{
action : 'et_pb_submit_subscribe_form',
et_load_nonce : et_custom.et_load_nonce,
et_list_id : list_id,
et_firstname : $firstname.val(),
et_lastname : $lastname.val(),
et_email : $email.val(),
et_service : service
},
beforeSend: function() {
$newsletter_container
.find( '.et_pb_newsletter_button' )
.addClass( 'et_pb_button_text_loading' )
.find('.et_subscribe_loader')
.show();
},
complete: function(){
$newsletter_container
.find( '.et_pb_newsletter_button' )
.removeClass( 'et_pb_button_text_loading' )
.find('.et_subscribe_loader')
.hide();
},
success: function( data ){
if ( data ) {
if ( data.error ) {
$result.html( data.error ).show();
}
if ( data.success ) {
$newsletter_container.find( '.et_pb_newsletter_form > p' ).hide();
$result.html( data.success ).show();
}
} else {
$result.html( et_custom.subscription_failed ).show();
}
}
} );
} );
function et_change_primary_nav_position( delay ) {
setTimeout( function() {
var $body = $('body'),
$wpadminbar = $( '#wpadminbar' ),
$top_header = $( '#top-header' ),
et_primary_header_top = 0;
if ( $wpadminbar.length ) {
et_primary_header_top += $wpadminbar.innerHeight();
}
if ( $top_header.length ) {
et_primary_header_top += $top_header.innerHeight();
}
if ( ! $body.hasClass( 'et_vertical_nav' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) {
$('#main-header').css( 'top', et_primary_header_top );
}
}, delay );
}
function et_hide_nav_transofrm( ) {
var $body = $( 'body' ),
$body_height = $( document ).height(),
$viewport_height = $( window ).height() + et_header_height + 200;
if ( $body.hasClass( 'et_hide_nav' ) || $body.hasClass( 'et_hide_nav_disabled' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) {
if ( $body_height > $viewport_height ) {
if ( $body.hasClass( 'et_hide_nav_disabled' ) ) {
$body.addClass( 'et_hide_nav' );
$body.removeClass( 'et_hide_nav_disabled' );
}
$('#main-header').css( 'transform', 'translateY(-' + et_header_height +'px)' );
$('#top-header').css( 'transform', 'translateY(-' + et_header_height +'px)' );
} else {
$('#main-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } );
$('#top-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } );
$body.removeClass( 'et_hide_nav' );
$body.addClass( 'et_hide_nav_disabled' );
}
}
}
function et_fix_testimonial_inner_width() {
var window_width = $( window ).width();
if( window_width > 767 ){
$( '.et_pb_testimonial' ).each( function() {
var $testimonial = $(this),
testimonial_width = $testimonial.width(),
$portrait = $testimonial.find( '.et_pb_testimonial_portrait' ),
portrait_width = $portrait.width(),
$testimonial_inner= $testimonial.find( '.et_pb_testimonial_description_inner' ),
$outer_column = $testimonial.closest( '.et_pb_column' ),
testimonial_inner_width = testimonial_width,
subtract = ! ( $outer_column.hasClass( 'et_pb_column_1_3' ) || $outer_column.hasClass( 'et_pb_column_1_4' ) || $outer_column.hasClass( 'et_pb_column_3_8' ) ) ? portrait_width + 31 : 0;
$testimonial_inner.width( testimonial_inner_width - subtract );
} );
} else {
$( '.et_pb_testimonial_description_inner' ).removeAttr( 'style' );
}
}
et_fix_testimonial_inner_width();
function et_calc_fullscreen_section() {
var $body = $( 'body' ),
$this_section = $(this),
$header = $this_section.children('.et_pb_fullwidth_header_container'),
$header_content = $header.children('.header-content-container'),
$header_image = $header.children('.header-image-container'),
sectionHeight = $( window ).height();
et_calculate_header_values();
var calc_header_offset = ( $( '#wpadminbar' ).length ) ? et_header_height + $( '#wpadminbar' ).innerHeight() - 1 : et_header_height - 1;
if ( ! $body.hasClass( 'et_hide_nav' ) ) {
if ( $this_section.offset().top <= calc_header_offset + 3 ) {
sectionHeight -= calc_header_offset;
}
}
$this_section.css('min-height', sectionHeight + 'px' );
$header.css('min-height', sectionHeight + 'px' );
if ( $header.hasClass('center') && $header_content.hasClass('bottom') && $header_image.hasClass('bottom') ) {
$header.addClass('bottom-bottom');
}
if ( $header.hasClass('center') && $header_content.hasClass('center') && $header_image.hasClass('center') ) {
$header.addClass('center-center');
}
if ( $header.hasClass('center') && $header_content.hasClass('center') && $header_image.hasClass('bottom') ) {
$header.addClass('center-bottom');
var contentHeight = sectionHeight - $header_image.outerHeight( true );
if ( contentHeight > 0 ) {
$header_content.css('min-height', contentHeight + 'px' );
}
}
if ( $header.hasClass('center') && $header_content.hasClass('bottom') && $header_image.hasClass('center') ) {
$header.addClass('bottom-center');
}
if ( ( $header.hasClass('left') || $header.hasClass('right') ) && !$header_content.length && $header_image.length ) {
$header.css('justify-content', 'flex-end');
}
if ( $header.hasClass('center') && $header_content.hasClass('bottom') && !$header_image.length ) {
$header_content.find('.header-content').css( 'margin-bottom', 80 + 'px' );
}
if ( $header_content.hasClass('bottom') && $header_image.hasClass('center') ) {
$header_image.find('.header-image').css( 'margin-bottom', 80 + 'px' );
$header_image.css('align-self', 'flex-end');
}
}
function et_fix_page_container_position(){
var et_window_width = $et_window.width(),
$top_header = $( '#top-header' ),
secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0;
// Set data-height-onload for header if the page is loaded on large screen
// If the page is loaded from small screen, rely on data-height-onload printed on the markup,
// prevent window resizing issue from small to large
if ( et_window_width > 980 && ! $main_header.attr( 'data-height-loaded' ) ){
$main_header.attr({ 'data-height-onload' : $main_header.height(), 'data-height-loaded' : true });
}
// Use on page load calculation for large screen. Use on the fly calculation for small screen (980px below)
if ( et_window_width <= 980 ) {
var header_height = $main_header.innerHeight() + secondary_nav_height - 1;
// If transparent is detected, #main-content .container's padding-top needs to be added to header_height
// And NOT a pagebuilder page
if ( $et_transparent_nav.length && ! $et_pb_first_row.length ) {
header_height += 58;
}
} else {
// Get header height from header attribute
var header_height = parseInt( $main_header.attr( 'data-height-onload' ) ) + secondary_nav_height;
// Non page builder page needs to be added by #main-content .container's fixed height
if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_main_content_first_row.length ) {
header_height += 58;
}
}
// Specific adjustment required for transparent nav + not vertical nav
if ( $et_transparent_nav.length && ! $et_vertical_nav.length ){
// Add class for first row for custom section padding purpose
$et_pb_first_row.addClass( 'et_pb_section_first' );
// List of conditionals
var is_pb = $et_pb_first_row.length,
is_post_pb = is_pb && $et_single_post.length,
is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length,
is_post_pb_full_layout_no_title = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length,
is_pb_fullwidth_section_first = $et_pb_first_row.is( '.et_pb_fullwidth_section' ),
is_no_pb_mobile = et_window_width <= 980 && $et_main_content_first_row.length;
if ( is_post_pb && ! ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first ) ) {
/* Desktop / Mobile + Single Post */
/*
* EXCEPT for fullwidth layout + fullwidth section ( at the first row ).
* It is basically the same as page + fullwidth section with few quirk.
* Instead of duplicating the conditional for each module, it'll be simpler to negate
* fullwidth layout + fullwidth section in is_post_pb and rely it to is_pb_fullwidth_section_first
*/
// Remove main content's inline padding to styling to prevent looping padding-top calculation
$et_main_content_first_row.css({ 'paddingTop' : '' });
if ( et_window_width < 980 ) {
header_height += 40;
}
if ( is_pb_fullwidth_section_first ) {
// If the first section is fullwidth, restore the padding-top modified area at first section
$et_pb_first_row.css({
'paddingTop' : '0',
});
}
if ( is_post_pb_full_layout_has_title ) {
// Add header height to post meta wrapper as padding top
$et_main_content_first_row_meta_wrapper.css({
'paddingTop' : header_height
});
} else if ( is_post_pb_full_layout_no_title ) {
$et_pb_first_row.css({
'paddingTop' : header_height
});
} else {
// Add header height to first row content as padding top
$et_main_content_first_row.css({
'paddingTop' : header_height
});
}
} else if ( is_pb_fullwidth_section_first ){
/* Desktop / Mobile + Pagebuilder + Fullwidth Section */
var $et_pb_first_row_first_module = $et_pb_first_row.children( '.et_pb_module:first' );
// Quirks: If this is post with fullwidth layout + no title + fullwidth section at first row,
// Remove the added height at line 2656
if ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first && et_window_width > 980 ) {
header_height = header_height - 58;
}
if ( $et_pb_first_row.children( '.et_pb_module:first' ).is( '.et_pb_slider' ) ) {
/* Desktop / Mobile + Pagebuilder + Fullwidth slider */
var $et_pb_first_row_slide_image = $et_pb_first_row.find( '.et_pb_slide_image' ),
$et_pb_first_row_slide = $et_pb_first_row.find( '.et_pb_slide' ),
$et_pb_first_row_slide_container = $et_pb_first_row.find( '.et_pb_slide .et_pb_container' ),
et_pb_slide_image_margin_top = 0 - ( parseInt( $et_pb_first_row_slide_image.height() ) / 2 ),
et_pb_slide_container_height = 0,
$et_pb_first_row_slider_arrow = $et_pb_first_row.find( '.et-pb-slider-arrows a'),
et_pb_first_row_slider_arrow_height = $et_pb_first_row_slider_arrow.height();
// Adding padding top to each slide so the transparency become useful
$et_pb_first_row_slide.css({
'paddingTop' : header_height,
});
// delete container's min-height
$et_pb_first_row_slide_container.css({
'min-height' : ''
});
// Adjusting slider's image, considering additional top padding of slideshow
$et_pb_first_row_slide_image.css({
'marginTop' : et_pb_slide_image_margin_top
});
// Adjusting slider's arrow, considering additional top padding of slideshow
$et_pb_first_row_slider_arrow.css({
'marginTop' : ( ( header_height / 2 ) - ( et_pb_first_row_slider_arrow_height / 2 ) )
});
// Looping the slide and get the highest height of slide
et_pb_first_row_slide_container_height_new = 0
$et_pb_first_row.find( '.et_pb_slide' ).each( function(){
var $et_pb_first_row_slide_item = $(this),
$et_pb_first_row_slide_container = $et_pb_first_row_slide_item.find( '.et_pb_container' );
// Make sure that the slide is visible to calculate correct height
$et_pb_first_row_slide_item.show();
// Remove existing inline css to make sure that it calculates the height
$et_pb_first_row_slide_container.css({ 'min-height' : '' });
var et_pb_first_row_slide_container_height = $et_pb_first_row_slide_container.innerHeight();
if ( et_pb_first_row_slide_container_height_new < et_pb_first_row_slide_container_height ){
et_pb_first_row_slide_container_height_new = et_pb_first_row_slide_container_height;
}
// Hide the slide back if it isn't active slide
if ( $et_pb_first_row_slide_item.is( ':not(".et-pb-active-slide")' ) ){
$et_pb_first_row_slide_item.hide();
}
});
// Setting appropriate min-height, considering additional top padding of slideshow
$et_pb_first_row_slide_container.css({
'min-height' : et_pb_first_row_slide_container_height_new
});
} else if ( $et_pb_first_row.children( '.et_pb_module:first' ).is( '.et_pb_fullwidth_header' ) ) {
/* Desktop / Mobile + Pagebuilder + Fullwidth header */
// Remove existing inline stylesheet to prevent looping padding
$et_pb_first_row_first_module.removeAttr( 'style' );
// Get paddingTop from stylesheet
var et_pb_first_row_fullwidth_header_padding_top = parseInt( $et_pb_first_row_first_module.css( 'paddingTop' ) );
// Implement stylesheet's padding-top + header_height
$et_pb_first_row_first_module.css({
'paddingTop' : ( header_height + et_pb_first_row_fullwidth_header_padding_top )
} );
} else if ( $et_pb_first_row.children( '.et_pb_module:first' ).is( '.et_pb_fullwidth_portfolio' ) ) {
/* Desktop / Mobile + Pagebuilder + Fullwidth Portfolio */
$et_pb_first_row.find( '.et_pb_fullwidth_portfolio' ).css({ 'paddingTop' : header_height });
} else if ( $et_pb_first_row_first_module.is( '.et_pb_map_container' ) ) {
/* Desktop / Mobile + Pagebuilder + Fullwidth Map */
var $et_pb_first_row_map = $et_pb_first_row_first_module.find( '.et_pb_map' );
// Remove existing inline height to prevent looping height calculation
$et_pb_first_row_map.css({ 'height' : '' });
// Implement map height + header height
$et_pb_first_row_first_module.find('.et_pb_map').css({
'height' : header_height + parseInt( $et_pb_first_row_map.css( 'height' ) )
});
// Adding specific class to mark the map as first row section element
$et_pb_first_row_first_module.addClass( 'et_beneath_transparent_nav' );
} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_menu' ) ) {
/* Desktop / Mobile + Pagebuilder + Fullwidth Menu */
$et_pb_first_row_first_module.css({ 'marginTop' : header_height });
} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_code' ) ) {
/* Desktop / Mobile + Pagebuilder + Fullwidth code */
var $et_pb_first_row_code = $et_pb_first_row_first_module;
$et_pb_first_row_code.css({ 'paddingTop' : '' });
var et_pb_first_row_code_padding_top = parseInt( $et_pb_first_row_code.css( 'paddingTop' ) );
$et_pb_first_row_code.css({
'paddingTop' : header_height + et_pb_first_row_code_padding_top
});
} else if ( $et_pb_first_row_first_module.is( '.et_pb_post_title' ) ) {
/* Desktop / Mobile + Pagebuilder + Fullwidth Post Title */
var $et_pb_first_row_title = $et_pb_first_row_first_module;
$et_pb_first_row_title.css({
'paddingTop' : header_height + 50
});
}
} else if ( is_pb ) {
/* Desktop / Mobile + Pagebuilder + Regular section */
// Remove first row's inline padding top styling to prevent looping padding-top calculation
$et_pb_first_row.css({ 'paddingTop' : '' });
// Pagebuilder ignores #main-content .container's fixed height and uses its row's padding
// Anticipate the use of custom section padding.
et_pb_first_row_padding_top = header_height + parseInt( $et_pb_first_row.css( 'paddingBottom' ) );
// Implementing padding-top + header_height
$et_pb_first_row.css({
'paddingTop' : et_pb_first_row_padding_top
});
} else if ( is_no_pb_mobile ) {
// Mobile + not pagebuilder
$et_main_content_first_row.css({
'paddingTop' : header_height
});
} else {
$('#main-content .container:first-child').css({
'paddingTop' : header_height
});
}
// Set #page-container's padding-top to zero after inline styling first row's content has been added
if ( ! $('#et_fix_page_container_position').length ){
$( '', {
'id' : 'et_fix_page_container_position',
'text' : '#page-container{ padding-top: 0 !important;}'
}).appendTo('head');
}
} else {
$main_container_wrapper.css( 'paddingTop', header_height );
}
et_change_primary_nav_position( 0 );
}
$( window ).resize( function(){
var window_width = $et_window.width(),
et_container_css_width = $et_container.css( 'width' ),
et_container_width_in_pixel = et_container_css_width.substr( -1, 1 ) !== '%',
et_container_actual_width = ( et_container_width_in_pixel ) ? $et_container.width() : ( ( $et_container.width() / 100 ) * window_width ), // $et_container.width() doesn't recognize pixel or percentage unit. It's our duty to understand what it returns and convert it properly
containerWidthChanged = et_container_width !== et_container_actual_width;
et_pb_resize_section_video_bg();
et_pb_center_video();
et_fix_slider_height();
if ( et_is_fixed_nav && containerWidthChanged ) {
if ( typeof update_page_container_position != 'undefined' ){
clearTimeout( update_page_container_position );
}
var update_page_container_position = setTimeout( function() {
et_fix_page_container_position();
}, 100 );
}
if ( et_hide_nav ) {
et_hide_nav_transofrm();
}
if ( $( '#wpadminbar' ).length && et_is_fixed_nav && window_width >= 740 && window_width <= 782 ) {
et_calculate_header_values();
et_change_primary_nav_position( 0 );
}
$et_pb_fullwidth_portfolio.each(function(){
set_container_height = $(this).hasClass('et_pb_fullwidth_portfolio_carousel') ? true : false;
set_fullwidth_portfolio_columns( $(this), set_container_height );
});
if ( containerWidthChanged ) {
$('.container-width-change-notify').trigger('containerWidthChanged');
setTimeout( function() {
$et_pb_filterable_portfolio.each(function(){
set_filterable_grid_items( $(this) );
});
$et_pb_gallery.each(function(){
if ( $(this).hasClass( 'et_pb_gallery_grid' ) ) {
set_gallery_grid_items( $(this) );
}
});
}, 100 );
et_container_width = et_container_actual_width;
etRecalculateOffset = true;
if ( $et_pb_circle_counter.length ) {
$et_pb_circle_counter.each(function(){
var $this_counter = $(this);
$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
});
}
}
et_set_search_form_css();
et_fix_testimonial_inner_width();
} );
$( window ).ready( function(){
if ( $.fn.fitVids ) {
$( '.et_pb_slide_video' ).fitVids();
$( '#main-content' ).fitVids( { customSelector: "iframe[src^='https://web.archive.org/web/20180716185729/http://www.hulu.com'], iframe[src^='https://web.archive.org/web/20180716185729/http://www.dailymotion.com'], iframe[src^='https://web.archive.org/web/20180716185729/http://www.funnyordie.com'], iframe[src^='https://web.archive.org/web/20180716185729/https://embed-ssl.ted.com'], iframe[src^='https://web.archive.org/web/20180716185729/http://embed.revision3.com'], iframe[src^='https://web.archive.org/web/20180716185729/https://flickr.com'], iframe[src^='https://web.archive.org/web/20180716185729/http://blip.tv'], iframe[src^='https://web.archive.org/web/20180716185729/http://www.collegehumor.com']"} );
}
et_fix_video_wmode('.fluid-width-video-wrapper');
et_fix_slider_height();
} );
$( window ).load( function(){
if ( et_is_fixed_nav ) {
et_calculate_header_values();
et_fix_page_container_position();
}
$( 'section.et_pb_fullscreen' ).each( function(){
var $this_section = $( this );
$.proxy( et_calc_fullscreen_section, $this_section )();
$et_window.on( 'resize', $.proxy( et_calc_fullscreen_section, $this_section ) );
});
$( '.et_pb_fullwidth_header_scroll a' ).click( function( event ) {
event.preventDefault();
var $this_section = $(this).parents( 'section' ),
$wpadminbar = $('#wpadminbar'),
wpadminbar_height = ( $wpadminbar.length ) ? $wpadminbar.height() : 0,
menu_height = $main_header.height() + $top_header.height(),
section_bottom = $this_section.offset().top + $this_section.outerHeight( true ) - menu_height - wpadminbar_height;
if ( $this_section.length ) {
$( 'html, body' ).animate( { scrollTop : section_bottom }, 800 );
if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) {
setTimeout(function(){
var section_bottom = $this_section.offset().top + $this_section.outerHeight( true ) - ( $main_header.height() + $top_header.height() ) - wpadminbar_height;
$( 'html, body' ).animate( { scrollTop : section_bottom }, 280, 'linear' );
}, 780 );
}
}
});
if ( et_header_style_left && !et_vertical_navigation) {
$logo_width = $( '#logo' ).width();
if ( et_is_rtl ) {
$et_top_navigation.css( 'padding-right', $logo_width + 30 );
} else {
$et_top_navigation.css( 'padding-left', $logo_width + 30 );
}
}
setTimeout( function() {
$( '.et_pb_preload' ).removeClass( 'et_pb_preload' );
}, 500 );
if ( $.fn.hashchange ) {
$(window).hashchange( function(){
var hash = window.location.hash.substring(1);
process_et_hashchange( hash );
});
$(window).hashchange();
}
if ( $('p.demo_store').length ) {
$('#footer-bottom').css('margin-bottom' , $('p.demo_store').innerHeight());
}
if ( $et_pb_parallax.length && !et_is_mobile_device ) {
$et_pb_parallax.each(function(){
if ( $(this).hasClass('et_pb_parallax_css') ) {
return;
}
var $this_parent = $(this).parent();
$.proxy( et_parallax_set_height, $this_parent )();
$.proxy( et_apply_parallax, $this_parent )();
$et_window.on( 'scroll', $.proxy( et_apply_parallax, $this_parent ) );
$et_window.on( 'resize', $.proxy( et_parallax_set_height, $this_parent ) );
$et_window.on( 'resize', $.proxy( et_apply_parallax, $this_parent ) );
$this_parent.find('.et-learn-more .heading-more').click( function() {
setTimeout(function(){
$.proxy( et_parallax_set_height, $this_parent )();
}, 300 );
});
});
}
if ( $( '.et_pb_audio_module .mejs-audio' ).length || $( '.et_audio_content .mejs-audio' ).length ) {
$( '.et_pb_audio_module .mejs-audio, .et_audio_content .mejs-audio' ).each( function(){
var $this_player = $( this ),
$count_timer = $this_player.find( 'div.mejs-currenttime-container' ),
$time_rail = $this_player.find( '.mejs-time-rail' ),
$time_slider = $this_player.find( '.mejs-time-slider' ),
player_width = $this_player.innerWidth(),
controls_play_width = $this_player.find( '.mejs-play' ).outerWidth(),
time_width = $this_player.find( '.mejs-currenttime-container' ).outerWidth(),
volume_icon_width = $this_player.find( '.mejs-volume-button' ).outerWidth(),
volume_bar_width = $this_player.find( '.mejs-horizontal-volume-slider' ).outerWidth(),
new_time_rail_width;
$count_timer.addClass( 'custom' );
$this_player.find( '.mejs-controls div.mejs-duration-container' ).replaceWith( $count_timer );
new_time_rail_width = player_width - ( controls_play_width + time_width + volume_icon_width + volume_bar_width + 65 );
$time_rail.width( new_time_rail_width );
$time_slider.width( new_time_rail_width );
});
}
if ( $.fn.waypoint ) {
$( '.et_pb_counter_container, .et-waypoint' ).waypoint( {
offset: '75%',
handler: function() {
$(this).addClass( 'et-animated' );
}
} );
if ( $et_pb_circle_counter.length ) {
$et_pb_circle_counter.each(function(){
var $this_counter = $(this);
$this_counter.waypoint({
offset: '65%',
handler: function() {
$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
}
});
});
}
if ( $et_pb_number_counter.length ) {
$et_pb_number_counter.each(function(){
var $this_counter = $(this);
$this_counter.waypoint({
offset: '75%',
handler: function() {
$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
}
});
});
}
if ( et_is_vertical_fixed_nav ) {
var $waypoint_selector = $('#main-content');
$waypoint_selector.waypoint( {
handler : function( direction ) {
if ( direction === 'down' ) {
$('#main-header').addClass( 'et-fixed-header' );
} else {
$('#main-header').removeClass( 'et-fixed-header' );
}
}
} );
}
if ( et_is_fixed_nav ) {
if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_pb_first_row.length ){
// Fullscreen section at the first row requires specific adjustment
if ( $et_pb_first_row.is( '.et_pb_fullwidth_section' ) ){
var $waypoint_selector = $et_pb_first_row.children('.et_pb_module');
} else {
var $waypoint_selector = $et_pb_first_row.find('.et_pb_row');
}
} else if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_main_content_first_row.length ) {
var $waypoint_selector = $('#content-area');
} else {
var $waypoint_selector = $('#main-content');
}
$waypoint_selector.waypoint( {
offset: function() {
if ( etRecalculateOffset ) {
setTimeout( function() {
et_calculate_header_values();
}, 200 );
etRecalculateOffset = false;
}
if ( et_hide_nav ) {
return et_header_offset - et_header_height - 200;
} else {
// Transparent nav modification: #page-container's offset is set to 0. Modify et_header_offset's according to header height
var waypoint_selector_offset = $waypoint_selector.offset();
if ( waypoint_selector_offset.top < et_header_offset ) {
et_header_offset = 0 - ( et_header_offset - waypoint_selector_offset.top );
}
return et_header_offset;
}
},
handler : function( direction ) {
if ( direction === 'down' ) {
$main_header.addClass( 'et-fixed-header' );
$main_container_wrapper.addClass ( 'et-animated-content' );
$top_header.addClass( 'et-fixed-header' );
if ( ! et_hide_nav && ! $et_transparent_nav.length && ! $( '.mobile_menu_bar' ).is(':visible') ) {
var secondary_nav_height = $top_header.height(),
$clone_header,
clone_header_height,
fix_padding;
$clone_header = $main_header.clone().addClass( 'et-fixed-header, et_header_clone' ).css( { 'transition': 'none', 'display' : 'none' } );
clone_header_height = $clone_header.prependTo( 'body' ).height();
fix_padding = parseInt( $main_container_wrapper.css( 'padding-top' ) ) - clone_header_height - secondary_nav_height + 1 ;
$main_container_wrapper.css( 'margin-top', -fix_padding );
$( '.et_header_clone' ).remove();
}
} else {
$main_header.removeClass( 'et-fixed-header' );
$top_header.removeClass( 'et-fixed-header' );
$main_container_wrapper.css( 'margin-top', '-1px' );
}
setTimeout( function() {
et_set_search_form_css();
}, 400 );
}
} );
}
if ( et_hide_nav ) {
et_hide_nav_transofrm();
}
}
} );
function et_pb_smooth_scroll( $target, $top_section, speed, easing ) {
var $window_width = $( window ).width();
if ( $( 'body' ).hasClass( 'et_fixed_nav' ) && $window_width > 980 ) {
$menu_offset = $( '#top-header' ).outerHeight() + $( '#main-header' ).outerHeight() - 1;
} else {
$menu_offset = -1;
}
if ( $ ('#wpadminbar').length && $window_width > 600 ) {
$menu_offset += $( '#wpadminbar' ).outerHeight();
}
//fix sidenav scroll to top
if ( $top_section ) {
$scroll_position = 0;
} else {
$scroll_position = $target.offset().top - $menu_offset;
}
// set swing (animate's scrollTop default) as default value
if( typeof easing === 'undefined' ){
easing = 'swing';
}
$( 'html, body' ).animate( { scrollTop : $scroll_position }, speed, easing );
}
$( 'a[href*=#]:not([href=#])' ).click( function() {
if ( $(this).closest( '.woocommerce-tabs' ).length && $(this).closest( '.tabs' ).length ) {
return false;
}
if ( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname ) {
var target = $( this.hash );
target = target.length ? target : $( '[name=' + this.hash.slice(1) +']' );
if ( target.length ) {
et_pb_smooth_scroll( target, false, 800 );
if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) {
setTimeout(function(){
et_pb_smooth_scroll( target, false, 40, 'linear' );
}, 780 );
}
return false;
}
}
});
if ( $( '.et_pb_section' ).length > 1 && $( '.et_pb_side_nav_page' ).length ) {
var $i=0;
$( '#main-content' ).append( '
' );
$( '.et_pb_section' ).each( function(){
if ( $( this ).height() > 0 ) {
$active_class = $i == 0 ? 'active' : '';
$( '.et_pb_side_nav' ).append( '
' + $i + '' );
$( this ).addClass( 'et_pb_scroll_' + $i );
$i++;
}
});
$side_nav_offset = ( $i * 20 + 40 ) / 2;
$( 'ul.et_pb_side_nav' ).css( 'marginTop', '-' + parseInt( $side_nav_offset) + 'px' );
$( '.et_pb_side_nav' ).addClass( 'et-visible' );
$( '.et_pb_side_nav a' ).click( function(){
$top_section = ( $( this ).text() == "0" ) ? true : false;
$target = $( '.et_pb_scroll_' + $( this ).text() );
et_pb_smooth_scroll( $target, $top_section, 800);
if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) {
setTimeout(function(){
et_pb_smooth_scroll( $target, $top_section, 200);
},500);
}
return false;
});
$( window ).scroll( function(){
$add_offset = ( $( 'body' ).hasClass( 'et_fixed_nav' ) ) ? 20 : -90;
if ( $ ( '#wpadminbar' ).length && $( window ).width() > 600 ) {
$add_offset += $( '#wpadminbar' ).outerHeight();
}
$side_offset = ( $( 'body' ).hasClass( 'et_vertical_nav' ) ) ? $( '#top-header' ).height() + $add_offset + 60 : $( '#top-header' ).height() + $( '#main-header' ).height() + $add_offset;
for ( var $i = 0; $i <= $( '.side_nav_item a' ).length - 1; $i++ ) {
if ( $( window ).scrollTop() + $( window ).height() == $( document ).height() ) {
$last = $( '.side_nav_item a' ).length - 1;
$( '.side_nav_item a' ).removeClass( 'active' );
$( 'a#side_nav_item_id_' + $last ).addClass( 'active' );
} else {
if ( $( this ).scrollTop() >= $( '.et_pb_scroll_' + $i ).offset().top - $side_offset ) {
$( '.side_nav_item a' ).removeClass( 'active' );
$( 'a#side_nav_item_id_' + $i ).addClass( 'active' );
}
}
}
});
}
if ( $('.et_pb_scroll_top').length ) {
$(window).scroll(function(){
if ($(this).scrollTop() > 800) {
$('.et_pb_scroll_top').show().removeClass( 'et-hidden' ).addClass( 'et-visible' );
} else {
$('.et_pb_scroll_top').removeClass( 'et-visible' ).addClass( 'et-hidden' );
}
});
//Click event to scroll to top
$('.et_pb_scroll_top').click(function(){
$('html, body').animate({scrollTop : 0},800);
});
}
if ( $( '.comment-reply-link' ).length ) {
$( '.comment-reply-link' ).addClass( 'et_pb_button' );
}
if ( $( '.et_pb_row' ).length ) {
$( '.et_pb_row' ).each( function() {
var $this_row = $( this ),
row_class = '';
row_class = et_get_column_types( $this_row.find( '>.et_pb_column' ) );
if ( '' !== row_class && ( -1 !== row_class.indexOf( '1-4' ) || '_4col' === row_class ) ) {
$this_row.addClass( 'et_pb_row' + row_class );
}
if ( $this_row.find( '.et_pb_row_inner' ).length ) {
$this_row.find( '.et_pb_row_inner' ).each( function() {
var $this_row_inner = $( this );
row_class = et_get_column_types( $this_row_inner.find( '.et_pb_column' ) );
if ( '' !== row_class && -1 !== row_class.indexOf( '1-4' ) ) {
$this_row_inner.addClass( 'et_pb_row' + row_class );
}
});
}
});
}
function et_get_column_types( $columns ) {
var row_class = '';
if ( $columns.length ) {
$columns.each( function() {
var $this_column = $( this ),
column_type = $this_column.attr( 'class' ).split( 'et_pb_column_' )[1],
column_type_updated = column_type.replace( '_', '-' ).trim();
row_class += '_' + column_type_updated;
});
row_class = '_1-4_1-4_1-4_1-4' === row_class ? '_4col' : row_class;
}
return row_class;
}
if ( $( '.et_section_specialty' ).length ) {
$( '.et_section_specialty' ).each( function() {
var this_row = $( this ).find( '.et_pb_row' );
this_row.find( '>.et_pb_column:not(.et_pb_specialty_column)' ).addClass( 'et_pb_column_single' );
});
}
$( '#et_top_search' ).click( function() {
var $search_container = $( '.et_search_form_container' );
$( '.et_menu_container' ).removeClass( 'et_pb_menu_visible' ).removeClass( 'et_pb_no_animation' ).addClass('et_pb_menu_hidden');
$search_container.removeClass( 'et_pb_search_form_hidden' ).removeClass( 'et_pb_no_animation' ).addClass('et_pb_search_visible');
setTimeout( function() {
$( '.et_menu_container' ).addClass( 'et_pb_no_animation' );
$search_container.addClass( 'et_pb_no_animation' );
}, 1000);
$search_container.find( 'input' ).focus();
et_set_search_form_css();
});
function et_hide_search() {
$( '.et_menu_container' ).removeClass('et_pb_menu_hidden').removeClass( 'et_pb_no_animation' ).addClass( 'et_pb_menu_visible' );
$( '.et_search_form_container' ).removeClass('et_pb_search_visible').removeClass( 'et_pb_no_animation' ).addClass( 'et_pb_search_form_hidden' );
setTimeout( function() {
$( '.et_menu_container' ).addClass( 'et_pb_no_animation' );
$( '.et_search_form_container' ).addClass( 'et_pb_no_animation' );
}, 1000);
}
function et_set_search_form_css() {
var $search_container = $( '.et_search_form_container' );
var $body = $( 'body' );
if ( $search_container.hasClass( 'et_pb_search_visible' ) ) {
var header_height = $( '#main-header' ).innerHeight(),
menu_width = $( '#top-menu' ).width(),
font_size = $( '#top-menu li a' ).css( 'font-size' );
$search_container.css( { 'height' : header_height + 'px' } );
$search_container.find( 'input' ).css( 'font-size', font_size );
if ( ! $body.hasClass( 'et_header_style_left' ) ) {
$search_container.css( 'max-width', menu_width + 60 );
} else {
$search_container.find( 'form' ).css( 'max-width', menu_width + 60 );
}
}
}
$( '.et_close_search_field' ).click( function() {
et_hide_search();
});
$( document ).mouseup( function(e) {
var $header = $( '#main-header' );
if ( $( '.et_menu_container' ).hasClass('et_pb_menu_hidden') ) {
if ( ! $header.is( e.target ) && $header.has( e.target ).length === 0 ) {
et_hide_search();
}
}
});
/**
* In particular browser, map + parallax doesn't play well due the use of CSS 3D transform
*/
if ( $('.et_pb_section_parallax').length && $('.et_pb_map').length ) {
$('body').addClass( 'parallax-map-support' );
}
} );
})(jQuery)
}
/*
FILE ARCHIVED ON 18:57:29 Jul 16, 2018 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 12:14:08 Jul 06, 2022.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
SECTION 108(a)(3)).
*/
/*
playback timings (ms):
captures_list: 1983.134
exclusion.robots: 0.206
exclusion.robots.policy: 0.191
cdx.remote: 0.127
esindex: 0.016
LoadShardBlock: 615.408 (3)
PetaboxLoader3.datanode: 1277.847 (5)
CDXLines.iter: 14.261 (3)
load_resource: 1563.988 (2)
PetaboxLoader3.resolve: 878.256 (2)
*/