Current File : /home/n742ef5/royalanteam.com/wp-content/plugins/Ultimate_VC_Addons/assets/js/custom.js |
( function ( $ ) {
'use strict';
$.fn.vc_translate_row = function () {
const window_scroll = $( window ).scrollTop();
const window_height = $( window ).height();
$( this ).each( function ( index, element ) {
let mobile_disable = $( element ).attr(
'data-row-effect-mobile-disable'
);
if ( typeof mobile_disable === 'undefined' )
mobile_disable = 'false';
else mobile_disable = mobile_disable.toString();
if (
! /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
)
var is_mobile = 'false';
else var is_mobile = 'true';
if ( is_mobile == 'true' && mobile_disable == 'true' )
var disable_row_effect = 'true';
else var disable_row_effect = 'false';
if ( disable_row_effect == 'false' ) {
const percentage = 0;
const row_height = $( element ).outerHeight();
const row_top = $( element ).offset().top;
const position = row_top - window_scroll;
const row_visible = position + row_height;
const pcsense = $( element ).attr(
'data-parallax-content-sense'
);
const sense = pcsense / 100;
var translate = 0;
const cut =
window_height - window_height * ( percentage / 100 );
if ( row_visible <= cut && position <= 0 ) {
if ( row_height > window_height ) {
var translate = ( window_height - row_visible ) * sense;
} else {
var translate = -( position * sense );
}
if ( translate < 0 ) translate = 0;
} else {
translate = 0;
}
const find_class =
'.upb_row_bg,.upb_video-wrapper,.ult-vc-seperator,.ult-easy-separator-wrapper';
$( element )
.find( '.vc-row-translate-wrapper' )
.children()
.each( function ( index, child ) {
if ( ! jQuery( child ).is( find_class ) ) {
$( child ).css( {
transform:
'translate3d(0,' + translate + 'px,0)',
'-webkit-transform':
'translate3d(0,' + translate + 'px,0)',
'-ms-transform':
'translate3d(0,' + translate + 'px,0)',
} );
}
} );
}
} );
}; //end translate function
$.fn.vc_fade_row = function () {
const window_scroll = $( window ).scrollTop();
const window_height = $( window ).height();
$( this ).each( function ( index, element ) {
let mobile_disable = $( element ).attr(
'data-row-effect-mobile-disable'
);
if ( typeof mobile_disable === 'undefined' )
mobile_disable = 'false';
else mobile_disable = mobile_disable.toString();
if (
! /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
)
var is_mobile = 'false';
else var is_mobile = 'true';
if ( is_mobile == 'true' && mobile_disable == 'true' )
var disable_row_effect = 'true';
else var disable_row_effect = 'false';
if ( disable_row_effect == 'false' ) {
const min_opacity = 0;
let percentage = $( element ).data( 'fadeout-percentage' );
percentage = 100 - percentage;
const no_class = '';
const row_height = $( element ).outerHeight();
const row_top = $( element ).offset().top;
const position = row_top - window_scroll;
const row_bottom = position + row_height;
let opacity = 1;
const cut =
window_height - window_height * ( percentage / 100 );
const newop =
( ( cut - row_bottom ) / cut ) * ( 1 - min_opacity );
if ( newop > 0 ) opacity = 1 - newop;
if ( row_bottom <= cut ) {
if ( opacity < min_opacity ) opacity = min_opacity;
else if ( opacity > 1 ) opacity = 1;
$( element )
.children()
.each( function ( rindex, row_child ) {
const find_class =
'.upb_row_bg,.upb_video-wrapper,.ult-vc-seperator';
if ( ! $( row_child ).is( find_class ) ) {
$( row_child ).css( {
opacity,
} );
}
} );
} else {
$( element )
.children()
.each( function ( rindex, row_child ) {
$( row_child ).css( {
opacity,
} );
} );
}
}
} );
}; // end fade function
//Common documen ready event
jQuery( document ).ready( function () {
init_ultimate_spacer();
} );
//Common on window scroll event
jQuery( window ).scroll( function () {
const $hideOnMobile = jQuery( '.ult-no-mobile' ).length;
if (
! /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
) {
animate_block();
} else if ( $hideOnMobile >= 1 )
jQuery( '.ult-animation' ).css( 'opacity', 1 );
else animate_block();
$( '.vc-row-fade' ).vc_fade_row();
$( '.vc-row-translate' ).vc_translate_row();
} );
jQuery( window ).on( 'load', function () {
function is_touch_device() {
return (
'ontouchstart' in window ||
navigator.MaxTouchPoints > 0 ||
navigator.msMaxTouchPoints > 0
);
}
jQuery( '.ult-banner-block-custom-height' ).each( function (
index,
element
) {
const $blockimg = jQuery( this ).find( 'img' );
const block_width = jQuery( this ).width();
const block_height = jQuery( this ).height();
const img_width = $blockimg.width();
if ( block_width > block_height )
$blockimg.css( { width: '100%', height: 'auto' } );
} );
jQuery( '.ult-new-ib' ).each( function ( index, element ) {
if ( is_touch_device() ) {
jQuery( this )
.find( '.ult-new-ib-link' )
.click( function ( e ) {
e.preventDefault();
const href_url = jQuery( this ).attr( 'href' );
let delay_sec = jQuery( this ).data( 'touch-delay' );
if ( delay_sec == null ) delay_sec = 200;
setTimeout( function () {
window.location = href_url;
}, delay_sec );
} );
}
} );
let flip_resize_count = 0,
flip_time_resize = 0;
const flip_box_resize = function () {
jQuery( '.ifb-jq-height' ).each( function () {
jQuery( this ).find( '.ifb-back' ).css( 'height', 'auto' );
jQuery( this ).find( '.ifb-front' ).css( 'height', 'auto' );
const fh = parseInt(
jQuery( this )
.find( '.ifb-front > div' )
.outerHeight( true )
);
const bh = parseInt(
jQuery( this ).find( '.ifb-back > div' ).outerHeight( true )
);
const gr = fh > bh ? fh : bh;
jQuery( this )
.find( '.ifb-front' )
.css( 'height', gr + 'px' );
jQuery( this )
.find( '.ifb-back' )
.css( 'height', gr + 'px' );
if ( jQuery( this ).hasClass( 'vertical_door_flip' ) ) {
jQuery( this )
.find( '.ifb-flip-box' )
.css( 'height', gr + 'px' );
} else if (
jQuery( this ).hasClass( 'horizontal_door_flip' )
) {
jQuery( this )
.find( '.ifb-flip-box' )
.css( 'height', gr + 'px' );
} else if ( jQuery( this ).hasClass( 'style_9' ) ) {
jQuery( this )
.find( '.ifb-flip-box' )
.css( 'height', gr + 'px' );
}
} );
jQuery( '.ifb-auto-height' ).each( function () {
if (
jQuery( this ).hasClass( 'horizontal_door_flip' ) ||
jQuery( this ).hasClass( 'vertical_door_flip' )
) {
const fh = parseInt(
jQuery( this ).find( '.ifb-front > div' ).outerHeight()
);
const bh = parseInt(
jQuery( this ).find( '.ifb-back > div' ).outerHeight()
);
const gr = fh > bh ? fh : bh;
jQuery( this )
.find( '.ifb-flip-box' )
.css( 'height', gr + 'px' );
}
} );
};
if (
navigator.userAgent.indexOf( 'Safari' ) != -1 &&
navigator.userAgent.indexOf( 'Chrome' ) == -1
) {
setTimeout( function () {
flip_box_resize();
}, 500 );
} else {
flip_box_resize();
}
jQuery( document ).on(
'ultAdvancedTabClicked',
function ( event, nav ) {
flip_box_resize();
}
);
jQuery( window ).resize( function () {
flip_resize_count++;
setTimeout( function () {
flip_time_resize++;
if ( flip_resize_count == flip_time_resize ) {
flip_box_resize();
}
}, 500 );
} );
const tiid = 0;
let mason_des = 0;
jQuery( window ).resize( function () {
ib_responsive();
jQuery( '.csstime.smile-icon-timeline-wrap' ).each( function () {
timeline_icon_setting( jQuery( this ) );
} );
$( '.jstime .timeline-wrapper' ).each( function () {
timeline_icon_setting( jQuery( this ) );
} );
if (
jQuery( '.smile-icon-timeline-wrap.jstime .timeline-line' ).css(
'display'
) == 'none'
) {
if ( mason_des === 0 ) {
$( '.jstime .timeline-wrapper' ).masonry( 'destroy' );
mason_des = 1;
}
} else if ( mason_des == 1 ) {
jQuery( '.jstime .timeline-wrapper' ).masonry( {
itemSelector: '.timeline-block',
} );
setTimeout( function () {
jQuery( '.jstime .timeline-wrapper' ).masonry( {
itemSelector: '.timeline-block',
width: '401px',
} );
jQuery( this )
.find( '.timeline-block' )
.each( function () {
jQuery( this ).css( 'left', 'initial' );
if ( jQuery( this ).css( 'left' ) == '0px' ) {
jQuery( this ).addClass( 'timeline-post-left' );
} else {
jQuery( this ).addClass(
'timeline-post-right'
);
}
} );
mason_des = 0;
}, 300 );
}
} );
$( '.smile-icon-timeline-wrap' ).each( function () {
const cstm_width = jQuery( this ).data( 'timeline-cutom-width' );
if ( cstm_width ) {
jQuery( this ).css( 'width', cstm_width * 2 + 40 + 'px' );
}
const width = parseInt( jQuery( this ).width() );
const b_wid = parseInt(
jQuery( this ).find( '.timeline-block' ).width()
);
const l_pos = ( b_wid / width ) * 100;
let time_r_margin = width - b_wid * 2 - 40;
time_r_margin = ( time_r_margin / width ) * 100;
$( '.jstime .timeline-wrapper' ).each( function () {
jQuery( this ).masonry( {
itemSelector: '.timeline-block',
} );
} );
setTimeout( function () {
$( '.jstime .timeline-wrapper' ).each( function () {
jQuery( this )
.find( '.timeline-block' )
.each( function () {
if ( jQuery( this ).css( 'left' ) == '0px' ) {
jQuery( this ).addClass( 'timeline-post-left' );
} else {
jQuery( this ).addClass(
'timeline-post-right'
);
}
timeline_icon_setting( jQuery( this ) );
} );
jQuery( '.timeline-block' ).each( function () {
const div =
parseInt( jQuery( this ).css( 'top' ) ) -
parseInt( jQuery( this ).next().css( 'top' ) );
if ( ( div < 14 && div > 0 ) || div == 0 ) {
jQuery( this )
.next()
.addClass( 'time-clash-right' );
} else if ( div > -14 ) {
jQuery( this ).next().addClass( 'time-clash-left' );
}
} );
} );
jQuery( '.timeline-post-right' ).each( function () {
const cl = jQuery( this )
.find( '.timeline-icon-block' )
.clone();
jQuery( this ).find( '.timeline-icon-block' ).remove();
jQuery( this ).find( '.timeline-header-block' ).after( cl );
} );
jQuery( '.smile-icon-timeline-wrap' ).each( function () {
const block_bg = jQuery( this ).data(
'time_block_bg_color'
);
jQuery( this )
.find( '.timeline-block' )
.css( 'background-color', block_bg );
jQuery( this )
.find( '.timeline-post-left.timeline-block l' )
.css( 'border-left-color', block_bg );
jQuery( this )
.find( '.timeline-post-right.timeline-block l' )
.css( 'border-right-color', block_bg );
jQuery( this )
.find( '.feat-item' )
.css( 'background-color', block_bg );
if (
jQuery( this ).find( '.feat-item' ).find( '.feat-top' )
.length > 0
)
jQuery( this )
.find( '.feat-item l' )
.css( 'border-top-color', block_bg );
else
jQuery( this )
.find( '.feat-item l' )
.css( 'border-bottom-color', block_bg );
jQuery( '.jstime.timeline_preloader' ).remove();
if (
jQuery( this )
.find( 'div' )
.hasClass( 'timeline-wrapper' )
) {
jQuery( this ).css( 'opacity', '1' );
} else {
jQuery( this ).remove();
}
} );
}, 1000 );
if (
! jQuery( this )
.find( '.timeline-line ' )
.next()
.hasClass( 'timeline-separator-text' )
) {
jQuery( this )
.find( '.timeline-line' )
.prepend( '<span></span>' );
}
const sep_col = jQuery( this ).data( 'time_sep_color' );
const sep_bg = jQuery( this ).data( 'time_sep_bg_color' );
const line_color = jQuery(
'.smile-icon-timeline-wrap .timeline-line'
).css( 'border-right-color' );
jQuery( this )
.find( '.timeline-dot' )
.css( 'background-color', sep_bg );
jQuery( this )
.find( '.timeline-line span' )
.css( 'background-color', sep_bg );
jQuery( this )
.find( '.timeline-line span' )
.css( 'background-color', sep_bg );
jQuery( this )
.find( '.timeline-separator-text' )
.css( 'color', sep_col );
jQuery( this )
.find( '.timeline-separator-text .sep-text' )
.css( 'background-color', sep_bg );
jQuery( this )
.find( '.ult-timeline-arrow s' )
.css( 'border-color', 'rgba(255, 255, 255, 0) ' + line_color );
jQuery( this )
.find( '.feat-item .ult-timeline-arrow s' )
.css( 'border-color', line_color + ' rgba(255, 255, 255, 0)' );
jQuery( this )
.find( '.timeline-block' )
.css( 'border-color', line_color );
jQuery( this )
.find( '.feat-item' )
.css( 'border-color', line_color );
} );
// jQuery('.timeline-block').each(function(){
// var link_b = $(this).find('.link-box').attr('href');
// var link_t = $(this).find('.link-title').attr('href');
// if(link_b){
// jQuery(this).wrap('<a href='+link_b+'></a>')
// }
// if(link_t){
// jQuery(this).find('.ult-timeline-title').wrap('<a href='+link_t+'></a>')
// }
// });
// jQuery('.feat-item').each(function(){
// var link_b = $(this).find('.link-box').attr('href');
// if(link_b){
// jQuery(this).wrap('<a href='+link_b+'></a>')
// }
// });
} ); // end window load event
jQuery( document ).ready( function ( $ ) {
const $hideOnMobile = jQuery( '.ult-no-mobile' ).length;
if (
! /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
) {
animate_block();
} else if ( $hideOnMobile >= 1 )
jQuery( '.ult-animation' ).css( 'opacity', 1 );
else animate_block();
ib_responsive();
jQuery( '.ubtn' )
.on( 'mouseenter', function () {
const $this = jQuery( this );
$this
.find( '.ubtn-text' )
.css( 'color', $this.data( 'hover' ) );
$this
.find( '.ubtn-hover' )
.css( 'background', $this.data( 'hover-bg' ) )
.addClass( 'ubtn-hover-active' );
const hover_bg =
$this.data( 'hover-bg' ) != ''
? $this.data( 'hover-bg' )
: false;
setTimeout( function () {
if ( hover_bg !== false ) {
if ( $this.hasClass( '.ubtn-fade-bg' ) ) {
$this.css( 'background', $this.data( 'hover-bg' ) );
}
}
}, 150 );
let old_style = $this.attr( 'style' );
if ( $this.data( 'shadow-hover' ) != '' ) {
const old_shadow = $this.css( 'box-shadow' );
//console.log(old_shadow);
old_style += 'box-shadow:' + $this.data( 'shadow-hover' );
}
$this.attr( 'style', old_style );
if ( $this.data( 'border-hover' ) != '' ) {
$this.css( 'border-color', $this.data( 'border-hover' ) );
}
if ( $this.data( 'shadow-click' ) != 'none' ) {
const temp_adj = $this.data( 'shd-shadow' ) - 3;
if ( $this.is( '.shd-left' ) != '' )
$this.css( { right: temp_adj } );
else if ( $this.is( '.shd-right' ) != '' )
$this.css( { left: temp_adj } );
else if ( $this.is( '.shd-top' ) != '' )
$this.css( { bottom: temp_adj } );
else if ( $this.is( '.shd-bottom' ) != '' )
$this.css( { top: temp_adj } );
}
} )
.on( 'mouseleave', function () {
const $this = jQuery( this );
$this.find( '.ubtn-text' ).removeAttr( 'style' );
$this.find( '.ubtn-hover' ).removeClass( 'ubtn-hover-active' );
//$this.find(".ubtn-hover").removeAttr('style');
$this.css( 'background', $this.data( 'bg' ) );
const border_color = $this.data( 'border-color' );
let old_style = $this.attr( 'style' );
if ( $this.data( 'shadow-hover' ) != '' )
old_style += 'box-shadow:' + $this.data( 'shadow' );
$this.attr( 'style', old_style );
if ( $this.data( 'border-hover' ) != '' ) {
$this.css( 'border-color', border_color );
}
if ( $this.data( 'shadow-click' ) != 'none' ) {
$this.removeClass( 'no-ubtn-shadow' );
if ( $this.is( '.shd-left' ) != '' )
$this.css( { right: 'auto' } );
else if ( $this.is( '.shd-right' ) != '' )
$this.css( { left: 'auto' } );
else if ( $this.is( '.shd-top' ) != '' )
$this.css( { bottom: 'auto' } );
else if ( $this.is( '.shd-bottom' ) != '' )
$this.css( { top: 'auto' } );
}
} );
jQuery( '.ubtn' ).on( 'focus blur mousedown mouseup', function ( e ) {
const $this = jQuery( this );
if ( $this.data( 'shadow-click' ) != 'none' ) {
setTimeout( function () {
if ( $this.is( ':focus' ) ) {
$this.addClass( 'no-ubtn-shadow' );
if ( $this.is( '.shd-left' ) != '' )
$this.css( {
right: $this.data( 'shd-shadow' ) + 'px',
} );
else if ( $this.is( '.shd-right' ) != '' )
$this.css( {
left: $this.data( 'shd-shadow' ) + 'px',
} );
else if ( $this.is( '.shd-top' ) != '' )
$this.css( {
bottom: $this.data( 'shd-shadow' ) + 'px',
} );
else if ( $this.is( '.shd-bottom' ) != '' )
$this.css( {
top: $this.data( 'shd-shadow' ) + 'px',
} );
} else {
$this.removeClass( 'no-ubtn-shadow' );
if ( $this.is( '.shd-left' ) != '' )
$this.css( { right: 'auto' } );
else if ( $this.is( '.shd-right' ) != '' )
$this.css( { left: 'auto' } );
else if ( $this.is( '.shd-top' ) != '' )
$this.css( { bottom: 'auto' } );
else if ( $this.is( '.shd-bottom' ) != '' )
$this.css( { top: 'auto' } );
}
}, 0 );
}
} );
jQuery( '.ubtn' ).focusout( function () {
const $this = jQuery( this );
$this.removeClass( 'no-ubtn-shadow' );
if ( $this.is( '.shd-left' ) != '' ) $this.css( { right: 'auto' } );
else if ( $this.is( '.shd-right' ) != '' )
$this.css( { left: 'auto' } );
else if ( $this.is( '.shd-top' ) != '' )
$this.css( { bottom: 'auto' } );
else if ( $this.is( '.shd-bottom' ) != '' )
$this.css( { top: 'auto' } );
} );
jQuery( '.smile-icon-timeline-wrap.jstime' ).css( 'opacity', '0' );
jQuery( '.jstime.timeline_preloader' ).css( 'opacity', '1' );
jQuery( '.smile-icon-timeline-wrap.csstime .timeline-wrapper' ).each(
function () {
jQuery( '.csstime .timeline-block:even' ).addClass(
'timeline-post-left'
);
jQuery( '.csstime .timeline-block:odd' ).addClass(
'timeline-post-right'
);
}
);
jQuery( '.csstime .timeline-post-right' ).each( function () {
jQuery( this ).css( 'float', 'right' );
jQuery( "<div style='clear:both'></div>" ).insertAfter(
jQuery( this )
);
} );
jQuery( '.csstime.smile-icon-timeline-wrap' ).each( function () {
const block_bg = jQuery( this ).data( 'time_block_bg_color' );
jQuery( this )
.find( '.timeline-block' )
.css( 'background-color', block_bg );
jQuery( this )
.find( '.timeline-post-left.timeline-block l' )
.css( 'border-left-color', block_bg );
jQuery( this )
.find( '.timeline-post-right.timeline-block l' )
.css( 'border-right-color', block_bg );
jQuery( this )
.find( '.feat-item' )
.css( 'background-color', block_bg );
if (
jQuery( this ).find( '.feat-item' ).find( '.feat-top' ).length >
0
)
jQuery( this )
.find( '.feat-item l' )
.css( 'border-top-color', block_bg );
else
jQuery( this )
.find( '.feat-item l' )
.css( 'border-bottom-color', block_bg );
timeline_icon_setting( jQuery( this ) );
} );
// CSS3 Transitions.
jQuery(
'.aio-icon, .aio-icon-img, .flip-box, .ultb3-info, .icon_list_icon, .ult-banner-block, .uavc-list-icon, .ult_tabs, .icon_list_connector'
).each( function () {
if ( jQuery( this ).attr( 'data-animation' ) ) {
const animationName = jQuery( this ).attr( 'data-animation' ),
animationDelay =
'delay-' +
jQuery( this ).attr( 'data-animation-delay' );
if (
typeof animationName === 'undefined' ||
animationName === ''
)
return false;
$( this ).bsf_appear( function () {
const $this = jQuery( this );
//$this.css('opacity','0');
//setTimeout(function(){
$this.addClass( 'animated' ).addClass( animationName );
$this.addClass( 'animated' ).addClass( animationDelay );
//$this.css('opacity','1');
//},1000);
} );
}
} );
// Icon Tabs
// Stats Counter
jQuery( '.stats-block' ).each( function () {
$( this ).bsf_appear( function () {
const endNum = parseFloat(
jQuery( this )
.find( '.stats-number' )
.data( 'counter-value' )
);
const Num =
jQuery( this )
.find( '.stats-number' )
.data( 'counter-value' ) + ' ';
const speed = parseInt(
jQuery( this ).find( '.stats-number' ).data( 'speed' )
);
const ID = jQuery( this ).find( '.stats-number' ).data( 'id' );
const sep = jQuery( this )
.find( '.stats-number' )
.data( 'separator' );
let dec = jQuery( this )
.find( '.stats-number' )
.data( 'decimal' );
let dec_count = Num.split( '.' );
if ( dec_count[ 1 ] ) {
dec_count = dec_count[ 1 ].length - 1;
} else {
dec_count = 0;
}
let grouping = true;
if ( dec == 'none' ) {
dec = '';
}
if ( sep == 'none' ) {
grouping = false;
} else {
grouping = true;
}
const settings = {
useEasing: true,
useGrouping: grouping,
separator: sep,
decimal: dec,
};
const counter = new countUp(
ID,
0,
endNum,
dec_count,
speed,
settings
);
setTimeout( function () {
counter.start();
}, 500 );
} );
} );
// Flip-box
if (
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
) {
jQuery( '.ifb-flip-box' ).on( 'click', function ( event ) {
const flipBox = jQuery( this );
if ( flipBox.hasClass( 'ifb-hover' ) ) {
flipBox.removeClass( 'ifb-hover' );
} else {
flipBox.addClass( 'ifb-hover' );
}
} );
} else {
jQuery( document ).on(
'mouseenter mouseleave',
'.ifb-flip-box',
function ( event ) {
const flipBox = jQuery( this );
if ( flipBox.hasClass( 'ifb-hover' ) ) {
flipBox.removeClass( 'ifb-hover' );
} else {
flipBox.addClass( 'ifb-hover' );
}
}
);
}
jQuery( '.ifb-flip-box' ).each( function ( index, element ) {
if ( jQuery( this ).parent().hasClass( 'style_9' ) ) {
jQuery( this )
.on( 'mouseenter', function () {
jQuery( this ).addClass( 'ifb-door-hover' );
} )
.on( 'mouseleave', function () {
jQuery( this ).removeClass( 'ifb-door-hover' );
} );
jQuery( this ).on( 'click', function () {
jQuery( this ).toggleClass( 'ifb-door-right-open' );
jQuery( this ).removeClass( 'ifb-door-hover' );
} );
}
} );
jQuery( document ).on( 'click', '.ifb-flip-box', function ( event ) {
event.stopPropagation();
jQuery( document ).trigger( 'ultFlipBoxClicked', jQuery( this ) );
} );
//Flipbox
//Vertical Door Flip
jQuery( '.vertical_door_flip .ifb-front' ).each( function () {
jQuery( this ).wrap(
'<div class="v_door ifb-multiple-front ifb-front-1"></div>'
);
jQuery( this )
.parent()
.clone()
.removeClass( 'ifb-front-1' )
.addClass( 'ifb-front-2' )
.insertAfter( jQuery( this ).parent() );
} );
//Reverse Vertical Door Flip
jQuery( '.reverse_vertical_door_flip .ifb-back' ).each( function () {
jQuery( this ).wrap(
'<div class="rv_door ifb-multiple-back ifb-back-1"></div>'
);
jQuery( this )
.parent()
.clone()
.removeClass( 'ifb-back-1' )
.addClass( 'ifb-back-2' )
.insertAfter( jQuery( this ).parent() );
} );
//Horizontal Door Flip
jQuery( '.horizontal_door_flip .ifb-front' ).each( function () {
jQuery( this ).wrap(
'<div class="h_door ifb-multiple-front ifb-front-1"></div>'
);
jQuery( this )
.parent()
.clone()
.removeClass( 'ifb-front-1' )
.addClass( 'ifb-front-2' )
.insertAfter( jQuery( this ).parent() );
} );
//Reverse Horizontal Door Flip
jQuery( '.reverse_horizontal_door_flip .ifb-back' ).each( function () {
jQuery( this ).wrap(
'<div class="rh_door ifb-multiple-back ifb-back-1"></div>'
);
jQuery( this )
.parent()
.clone()
.removeClass( 'ifb-back-1' )
.addClass( 'ifb-back-2' )
.insertAfter( jQuery( this ).parent() );
} );
//Stlye 9 front
jQuery( '.style_9 .ifb-front' ).each( function () {
jQuery( this ).wrap(
'<div class="new_style_9 ifb-multiple-front ifb-front-1"></div>'
);
jQuery( this )
.parent()
.clone()
.removeClass( 'ifb-front-1' )
.addClass( 'ifb-front-2' )
.insertAfter( jQuery( this ).parent() );
} );
//Style 9 back
jQuery( '.style_9 .ifb-back' ).each( function () {
jQuery( this ).wrap(
'<div class="new_style_9 ifb-multiple-back ifb-back-1"></div>'
);
jQuery( this )
.parent()
.clone()
.removeClass( 'ifb-back-1' )
.addClass( 'ifb-back-2' )
.insertAfter( jQuery( this ).parent() );
} );
const is_safari = /^((?!chrome).)*safari/i.test( navigator.userAgent );
if ( is_safari ) {
jQuery( '.vertical_door_flip' ).each( function ( index, element ) {
const safari_link = jQuery( this )
.find( '.flip_link' )
.outerHeight();
jQuery( this )
.find( '.flip_link' )
.css( 'top', -safari_link / 2 + 'px' );
jQuery( this )
.find( '.ifb-multiple-front' )
.css( 'width', '50.2%' );
} );
jQuery( '.horizontal_door_flip' ).each( function (
index,
element
) {
const safari_link = jQuery( this )
.find( '.flip_link' )
.outerHeight();
jQuery( this )
.find( '.flip_link' )
.css( 'top', -safari_link / 2 + 'px' );
jQuery( this )
.find( '.ifb-multiple-front' )
.css( 'height', '50.2%' );
} );
jQuery( '.reverse_vertical_door_flip' ).each( function (
index,
element
) {
const safari_link = jQuery( this )
.find( '.flip_link' )
.outerHeight();
jQuery( this )
.find( '.flip_link' )
.css( 'top', -safari_link / 2 + 'px' );
} );
jQuery( '.reverse_horizontal_door_flip' ).each( function (
index,
element
) {
const safari_link = jQuery( this )
.find( '.flip_link' )
.outerHeight();
jQuery( this )
.find( '.flip_link' )
.css( 'top', -safari_link / 2 + 'px' );
jQuery( this ).find( '.ifb-back' ).css( 'position', 'inherit' );
} );
}
//Info Box
jQuery( '.square_box-icon' ).each( function ( index, element ) {
const $box = jQuery( this );
if ( jQuery( this ).find( '.aio-icon-img' ).length > 0 ) {
var $icon = jQuery( this ).find( '.aio-icon-img' );
info_box_adjust_icon( $box, $icon, 'img' );
$icon.find( '.img-icon' ).on( 'load', function () {
info_box_adjust_icon( $box, $icon, 'icon' );
} );
} else {
var $icon = jQuery( this ).find( '.aio-icon' );
info_box_adjust_icon( $box, $icon, 'icon' );
jQuery( window ).on( 'load', function () {
info_box_adjust_icon( $box, $icon, 'icon' );
} );
}
} );
} ); //end document ready event
function info_box_adjust_icon( $box, $icon, icon_type ) {
if ( icon_type === 'img' ) {
var ib_box_style_icon_height = parseInt( $icon.outerHeight() );
var ib_padding = ib_box_style_icon_height / 2;
$box.css( 'padding-top', ib_padding + 'px' );
$box.parent().css( 'margin-top', ib_padding + 20 + 'px' );
$icon.css( 'top', -ib_box_style_icon_height + 'px' );
} else {
var ib_box_style_icon_height = parseInt( $icon.outerHeight() );
var ib_padding = ib_box_style_icon_height / 2;
$box.css( 'padding-top', ib_padding + 'px' );
$box.parent().css( 'margin-top', ib_padding + 20 + 'px' );
$icon.css( 'top', -ib_box_style_icon_height + 'px' );
}
}
function timeline_icon_setting( ele ) {
//setting to est icon if any
if ( ele.find( '.timeline-icon-block' ).length > 0 ) {
$( '.timeline-block' ).each( function ( index, element ) {
const $hbblock = $( this ).find( '.timeline-header-block' );
const $icon = $( this ).find( '.timeline-icon-block' );
$icon.css( { position: 'absolute' } );
const icon_height = $icon.outerHeight();
const icon_width = $icon.outerWidth();
const diff_pos = -( icon_width / 2 );
const padding_fixer = parseInt(
$hbblock
.find( '.timeline-header' )
.css( 'padding-left' )
.replace( /[^\d.]/g, '' )
);
if ( $( this ).hasClass( 'timeline-post-left' ) ) {
$icon.css( { left: diff_pos, right: 'auto' } );
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
$icon.css( { left: 'auto', right: diff_pos } );
}
//$hbblock.css({'padding-left':((icon_width/2)+padding_fixer)+'px'});
} else if ( $( this ).hasClass( 'timeline-post-right' ) ) {
$icon.css( { left: 'auto', right: diff_pos } );
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
$icon.css( { left: diff_pos, right: 'auto' } );
}
//$hbblock.css({'padding-right':((icon_width/2)+padding_fixer)+'px'});
}
const blheight = $hbblock.height();
const blmidheight = blheight / 2;
const icon_mid_height = icon_height / 2;
const diff = blmidheight - icon_mid_height;
$icon.css( { top: diff } );
const tleft = $icon.offset().left;
const winw = $( window ).width();
if ( 0 > tleft || winw < tleft + icon_width ) {
$icon.css( {
position: 'relative',
top: 'auto',
left: 'auto',
right: 'auto',
'text-align': 'center',
} );
$icon.children().children().css( { margin: '10px auto' } );
$hbblock.css( { padding: '0' } );
}
} );
}
}
// CSS3 Transitions.
function animate_block() {
jQuery( '.ult-animation' ).each( function () {
if ( jQuery( this ).attr( 'data-animate' ) ) {
//var child = jQuery(this).children('div');
const child2 = jQuery( this ).children( '*' );
//var child = jQuery('.ult-animation > *');
//console.log(child);
const animationName = jQuery( this ).attr( 'data-animate' ),
animationDuration =
jQuery( this ).attr( 'data-animation-duration' ) + 's',
animationIteration = jQuery( this ).attr(
'data-animation-iteration'
),
animationDelay = jQuery( this ).attr(
'data-animation-delay'
),
animationViewport = jQuery( this ).attr(
'data-opacity_start_effect'
);
const style =
'opacity:1;-webkit-animation-delay:' +
animationDelay +
's;-webkit-animation-duration:' +
animationDuration +
';-webkit-animation-iteration-count:' +
animationIteration +
'; -moz-animation-delay:' +
animationDelay +
's;-moz-animation-duration:' +
animationDuration +
';-moz-animation-iteration-count:' +
animationIteration +
'; animation-delay:' +
animationDelay +
's;animation-duration:' +
animationDuration +
';animation-iteration-count:' +
animationIteration +
';';
const container_style =
'opacity:1;-webkit-transition-delay: ' +
animationDelay +
's; -moz-transition-delay: ' +
animationDelay +
's; transition-delay: ' +
animationDelay +
's;';
if ( isAppear( jQuery( this ) ) ) {
//jQuery(this).css('opacity','1');
let p_st = jQuery( this ).attr( 'style' );
if ( typeof p_st === 'undefined' ) {
p_st = 'test';
}
p_st = p_st.replace( / /g, '' );
if ( p_st == 'opacity:0;' ) {
if ( p_st.indexOf( container_style ) !== 0 ) {
jQuery( this ).attr( 'style', container_style );
}
}
jQuery.each( child2, function ( index, value ) {
const $this = jQuery( value );
let prev_style = $this.attr( 'style' );
if ( typeof prev_style === 'undefined' ) {
prev_style = 'test';
}
let new_style = '';
if ( prev_style.indexOf( style ) == 0 ) {
new_style = prev_style;
} else {
new_style = style + prev_style;
}
$this.attr( 'style', new_style );
if ( isAppear( $this ) ) {
$this
.addClass( 'animated' )
.addClass( animationName );
}
} );
}
}
} );
}
function isAppear( id ) {
const window_scroll = jQuery( window ).scrollTop();
const window_height = jQuery( window ).height();
if ( jQuery( id ).hasClass( 'ult-animate-viewport' ) )
var start_effect = jQuery( id ).data( 'opacity_start_effect' );
if ( typeof start_effect === 'undefined' || start_effect == '' )
var percentage = 2;
else var percentage = 100 - start_effect;
const element_height = jQuery( id ).outerHeight();
const element_top = jQuery( id ).offset().top;
const position = element_top - window_scroll;
const cut = window_height - window_height * ( percentage / 100 );
if ( position <= cut ) return true;
return false;
}
// function for IB responsive
function ib_responsive() {
const new_ib = jQuery( '.ult-new-ib' );
new_ib.each( function ( index, element ) {
const $this = jQuery( this );
if ( $this.hasClass( 'ult-ib-resp' ) ) {
const w = jQuery( document ).width();
const ib_min = $this.data( 'min-width' );
const ib_max = $this.data( 'max-width' );
if ( w <= ib_max && w >= ib_min ) {
$this.find( '.ult-new-ib-content' ).hide();
} else {
$this.find( '.ult-new-ib-content' ).show();
}
}
} );
}
//function for resize spacer
function init_ultimate_spacer() {
let css = '';
$( '.ult-spacer' ).each( function ( i, spacer ) {
const uid = $( spacer ).data( 'id' );
const body_width = $( 'body' ).width();
const height_on_mob = $( spacer ).data( 'height-mobile' );
const height_on_mob_landscape = $( spacer ).data(
'height-mobile-landscape'
);
const height_on_tabs = $( spacer ).data( 'height-tab' );
const height_on_tabs_portrait = $( spacer ).data(
'height-tab-portrait'
);
const height = $( spacer ).data( 'height' );
if ( height != '' ) {
css += ' .spacer-' + uid + ' { height:' + height + 'px } ';
}
if (
height_on_tabs != '' ||
height_on_tabs == '0' ||
height_on_tabs == 0
) {
css +=
' @media (max-width: 1199px) { .spacer-' +
uid +
' { height:' +
height_on_tabs +
'px } } ';
}
if (
typeof height_on_tabs_portrait !== 'undefined' &&
( height_on_tabs_portrait != '' ||
height_on_tabs_portrait == '0' ||
height_on_tabs_portrait == 0 )
) {
css +=
' @media (max-width: 991px) { .spacer-' +
uid +
' { height:' +
height_on_tabs_portrait +
'px } } ';
}
if (
typeof height_on_mob_landscape !== 'undefined' &&
( height_on_mob_landscape != '' ||
height_on_mob_landscape == '0' ||
height_on_mob_landscape == 0 )
) {
css +=
' @media (max-width: 767px) { .spacer-' +
uid +
' { height:' +
height_on_mob_landscape +
'px } } ';
}
if (
height_on_mob != '' ||
height_on_mob == '0' ||
height_on_mob == 0
) {
css +=
' @media (max-width: 479px) { .spacer-' +
uid +
' { height:' +
height_on_mob +
'px } } ';
}
} );
if ( css != '' ) {
css = '<style>' + css + '</style>';
$( 'head' ).append( css );
}
}
} )( jQuery );
//ready
/* Interactive Banner 2 */
jQuery( document ).ready( function () {
jQuery(".ult-new-ib").css("opacity","1");
interactive_banner2();
jQuery( window ).on( 'load', function () {
interactive_banner2();
} );
jQuery( window ).resize( function () {
interactive_banner2();
} );
function interactive_banner2() {
jQuery( '.ult-new-ib' ).each( function ( index, element ) {
//var w_width = jQuery(window).width();
//if(w_width>=768) {
const banner_min_height = jQuery( this ).data( 'min-height' ) || '';
const img_min_height =
jQuery( this ).find( '.ult-new-ib-img' ).data( 'min-height' ) ||
'';
const img_max_height =
jQuery( this ).find( '.ult-new-ib-img' ).data( 'max-width' ) ||
'';
if ( banner_min_height != '' ) {
jQuery( this ).addClass( 'ult-ib2-min-height' );
jQuery( this ).css( 'height', banner_min_height );
jQuery( this )
.find( '.ult-new-ib-img' )
.removeClass( 'ult-ib2-toggle-size' );
const img_width = jQuery( this )
.find( '.ult-new-ib-img' )
.width();
const img_height = jQuery( this )
.find( '.ult-new-ib-img' )
.height();
const b_width = jQuery( this ).width();
if (
b_width <= banner_min_height ||
img_height < banner_min_height
)
jQuery( this )
.find( '.ult-new-ib-img' )
.addClass( 'ult-ib2-toggle-size' );
//if(banner_min_height < img_width)
//jQuery(this).find(".ult-new-ib-img")[0].style.setProperty( 'max-width', '100%', 'important' );
//jQuery(this).find(".ult-new-ib-img").css('max-width', '100%');
//jQuery(this).find(".ult-new-ib-img").css('min-height', img_min_height);
//jQuery(this).find(".ult-new-ib-img").css('max-width', img_max_height);
}
//} else {
// jQuery(this).removeClass('ult-ib2-min-height');
// jQuery(this).css('min-height', 'initial');
//jQuery(this).find(".ult-new-ib-img").css('min-height', 'initial');
//jQuery(this).find(".ult-new-ib-img").css('max-width', '100%');
//}
jQuery( this )
.on( 'mouseenter', function () {
jQuery( this )
.find( '.ult-new-ib-img' )
.css(
'opacity',
jQuery( this ).data( 'hover-opacity' )
);
} )
.on( 'mouseleave', function () {
jQuery( this )
.find( '.ult-new-ib-img' )
.css( 'opacity', jQuery( this ).data( 'opacity' ) );
} );
} );
}
} );
//resize map
jQuery( document ).ready( function () {
function resize_uvc_map() {
jQuery( '.ultimate-map-wrapper' ).each( function ( i, wrapelement ) {
const wrap = jQuery( wrapelement ).attr( 'id' );
if ( typeof wrap === 'undefined' || wrap === '' ) return false;
const map = jQuery( wrapelement )
.find( '.ultimate_google_map' )
.attr( 'id' );
const map_override = jQuery( '#' + map ).attr(
'data-map_override'
);
let is_relative = 'true';
jQuery( '#' + map ).css( { 'margin-left': 0 } );
jQuery( '#' + map ).css( { right: 0 } );
let ancenstor = jQuery( '#' + wrap ).parent();
const parent = ancenstor;
if ( map_override == 'full' ) {
ancenstor = jQuery( 'body' );
is_relative = 'false';
}
if ( map_override == 'ex-full' ) {
ancenstor = jQuery( 'html' );
is_relative = 'false';
}
if ( ! isNaN( map_override ) ) {
for ( var i = 0; i < map_override; i++ ) {
if ( ancenstor.prop( 'tagName' ) != 'HTML' ) {
ancenstor = ancenstor.parent();
} else {
break;
}
}
}
if ( map_override == 0 || map_override == '0' )
var w = ancenstor.width();
else var w = ancenstor.outerWidth();
const a_left = ancenstor.offset().left;
const left = jQuery( '#' + map ).offset().left;
const calculate_left = a_left - left;
jQuery( '#' + map ).css( { width: w } );
if ( map_override != 0 || map_override != '0' ) {
jQuery( '#' + map ).css( { 'margin-left': calculate_left } );
}
if ( map_override == 'full' ) {
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
const mapDiv = jQuery( '#' + map );
const rt =
jQuery( window ).width() -
( mapDiv.offset().left + mapDiv.outerWidth() );
jQuery( '#' + map ).css( { right: -rt } );
}
}
} );
}
resize_uvc_map();
jQuery( window ).on( 'load', function () {
resize_uvc_map();
} );
jQuery( window ).resize( function () {
resize_uvc_map();
} );
jQuery( '.ui-tabs' ).bind( 'tabsactivate', function ( event, ui ) {
if ( jQuery( this ).find( '.ultimate-map-wrapper' ).length > 0 ) {
resize_uvc_map();
}
} );
jQuery( '.ui-accordion' ).bind(
'accordionactivate',
function ( event, ui ) {
if ( jQuery( this ).find( '.ultimate-map-wrapper' ).length > 0 ) {
resize_uvc_map();
}
}
);
jQuery( document ).on( 'onUVCModalPopupOpen', function () {
resize_uvc_map();
} );
jQuery( document ).on( 'UVCMapResize', function () {
resize_uvc_map();
} );
} );