<?php
$divi_pxpre_preloader_color = et_get_option('divi_PX_pre_preloader_color');
$divi_pxpre_background_color = et_get_option('divi_PX_pre_background_color');
$divi_pxpre_body_opacity = et_get_option('divi_PX_pre_body_opacity');
$divi_pxpre_preloader_images = get_option( 'divi_pxpre_preloader_images') ;
if ( $divi_pxpre_preloader_images != '' ){ 
	$divi_pxpre_preloader_images = get_option( 'divi_pxpre_preloader_images' ) ;
}else{
	$divi_pxpre_preloader_images = 'px_loader1' ;
}
$divi_PX_pre_display_text_preloader = et_get_option('divi_PX_pre_display_text_preloader','off');
?>
<div class="px-overlay-loader <?php echo esc_attr($divi_pxpre_preloader_images); if ( $divi_PX_pre_display_text_preloader == 'on' ){ echo ' px_text px_text_'.esc_attr($divi_pxpre_preloader_images);}?>">
	<div class="px-loader">
		<span></span>
		<span></span>
		<span></span>
		<span></span>
	</div>
<?php if ( $divi_PX_pre_display_text_preloader == 'on' ){
			include get_stylesheet_directory() . '/extra-options/preloader/px_text_loader.php';
	} ?>
</div>
						
<style type="text/css">
.px_text.px_text_px_loader15 .px-loader {top: 35%;}.px_text.px_text_px_loader15 .txt-loading {top: 55%;}
.px-overlay-loader {position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: <?php echo esc_attr($divi_pxpre_background_color); ?>; opacity: <?php echo esc_attr($divi_pxpre_body_opacity); ?>;z-index: 999999;height: 100%;width: 100%;overflow: hidden !important;margin: auto;}
.px-loader{
    position: relative;
	top: 35%;
	background-repeat: no-repeat;
	background-position: center;
	-webkit-background-size: cover;
	background-size: cover;
    width: 100px;
    height: 100px;
    margin: 50px auto;
    overflow: hidden;
    position: relative;
}

.px-loader span{
    display: inline-block;
    position: absolute;
    animation-fill-mode: both;
    animation: loading-1 9s cubic-bezier(.45,.05,.55,.95) infinite;
}

.px-loader span:nth-child(1){
    background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    animation-name: loading-1;
}

.px-loader span:nth-child(2){
    background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    animation-name: loading-2;
}

.px-loader span:nth-child(3){
    background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    animation-name: loading-3;
}

.px-loader span:nth-child(4){
    background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    animation-name: loading-4;
}

@keyframes loading-1{
    0%{
        width: 25%;
        height: 25%;
        border-radius: 100% 0 0 0;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 50%;
        left: 25%;
    }
    5%{
        width: 25%;
        height: 25%;
        border-radius: 100% 0 0 0;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 50%;
        left: 25%;
    }
    10%{
        width: 25%;
        height: 25%;
        border-radius: 100% 100% 0 0;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 50%;
        left: 25%;
    }
    13%{
        width: 25%;
        height: 25%;
        border-radius: 100% 100% 0 0;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 50%;
        left: 12.5%;
    }
    18%{
        width: 25%;
        height: 25%;
        border-radius: 100% 100% 0 0;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 50%;
        left: 12.5%;
    }
    20%{
        width: 32.5%;
        height: 32.5%;
        border-radius: 50%;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 50%;
        left: 6.25%;
    }
    25%{
        width: 25%;
        height: 25%;
        border-radius: 50%;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 62.5%;
        left: 12.5%;
    }
    30%{
        width: 25%;
        height: 25%;
        border-radius: 50%;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 62.5%;
        left: 12.5%;
    }
    35%{
        width: 14%;
        height: 10%;
        border-radius: 999px;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        left: 0%;
        bottom: 0%;
    }
    40%{ height:100%; }
    55%{ height: 10%; }
    60%{ height:100%; }
    70%{
        width: 14%;
        height: 25%;
        border-radius: 999px;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        bottom: 0%;
        left: 0%;
    }
    75%{
        width: 25%;
        height: 25%;
        border-radius: 100%;
        bottom: 57.5%;
        left: 17.5%;
    }
    97%{
        width: 25%;
        height: 25%;
        border-radius: 100%;
        bottom: 57.5%;
        left: 17.5%;
    }
    100%{
        width: 50%;
        height: 50%;
        border-radius: 100%;
        bottom: 25%;
        left: 25%;
    }
}

@keyframes loading-2{
    0%{
        width: 25%;
        height: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 0 0 0 100%;
        bottom: 25%;
        left: 25%;
    }
    5%{
        width: 25%;
        height: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 0 0 0 100%;
        bottom: 25%;
        left: 25%;
    }
    10%{
        width: 25%;
        height: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 0 0 100% 100%;
        bottom: 25%;
        left: 25%;
    }
    13%{
        width: 25%;
        height: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 0 0 100% 100%;
        bottom: 25%;
        left: 12.5%;
    }
    18%{
        width: 25%;
        height: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 0 0 100% 100%;
        bottom: 25%;
        left: 12.5%;
    }
    20%{
        width: 32.5%;
        height: 32.5%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 50%;
        bottom: 25%;
        left: 6.25%;
    }
    25%{
        width: 25%;
        height: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 50%;
        bottom: 12.5%;
        left: 12.5%;
    }
    30%{
        left: 12.5%;
        bottom: 12.5%;
        border-radius: 50%;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    35%{
        left: 28%;
        bottom: 0%;
        border-radius: 999px;
        height: 10%;
        width: 14%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    40%{ height:10%; }
    45%{ height:100%; }
    60%{ height: 10%; }
    65%{ height:100%; }
    75%{
        left: 28%;
        bottom: 0%;
        border-radius: 999px;
        height: 25%;
        width: 14%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    80%{
        left: 17.5%;
        bottom: 17.5%;
        border-radius: 100%;
        height: 25%;
        width: 25%;
    }
    97%{
        left: 17.5%;
        bottom: 17.5%;
        border-radius: 100%;
        height: 25%;
        width: 25%;
        box-shadow: none;
    }
    100%{
        box-shadow: -3px -3px 5px -5px <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 100%;
        left: 25%;
        bottom: -50%;
        height: 50%;
        width: 50%;
    }
}

@keyframes loading-3{
    0%{
        left: 50%;
        bottom: 50%;
        border-radius: 0 100% 0 0;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    5%{
        left: 50%;
        bottom: 50%;
        border-radius: 0 100% 0 0;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    10%{
        left: 50%;
        bottom: 50%;
        border-radius: 100% 100% 0 0;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    13%{
        left: 62.5%;
        bottom: 50%;
        border-radius: 100% 100% 0 0;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    18%{
        left: 62.5%;
        bottom: 50%;
        border-radius: 100% 100% 0 0;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    20%{
        left: 66.25%;
        bottom: 50%;
        border-radius: 50%;
        height: 32.5%;
        width: 32.5%;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    25%{
        left: 62.5%;
        bottom: 62.5%;
        border-radius: 50%;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    30%{
        left: 62.5%;
        bottom: 62.5%;
        border-radius: 50%;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    35%{
        left: 56%;
        bottom: 0%;
        border-radius: 999px;
        height: 10%;
        width: 14%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    45%{ height:10%; }
    50%{ height:100%; }
    65%{ height: 10%; }
    70%{ height:100%; }
    80%{
        left: 56%;
        bottom: 0%;
        border-radius: 999px;
        height: 25%;
        width: 14%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    85%{
        left: 57.5%;
        bottom: 57.5%;
        border-radius: 100%;
        height: 25%;
        width: 25%;
    }
    97%{
        left: 57.5%;
        bottom: 57.5%;
        border-radius: 100%;
        height: 25%;
        width: 25%;
        box-shadow: none;
    }
    100%{
        box-shadow: -3px -3px 5px -5px <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 100%;
        left: 100%;
        bottom: 25%;
        height: 50%;
        width: 50%;
    }
}

@keyframes loading-4{
    0%{
        left: 50%;
        bottom: 25%;
        border-radius: 0 0 100% 0;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    5%{
        left: 50%;
        bottom: 25%;
        border-radius: 0 0 100% 0;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    10%{
        left: 50%;
        bottom: 25%;
        border-radius: 0 0 100% 100%;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    13%{
        left: 62.5%;
        bottom: 25%;
        border-radius: 0 0 100% 100%;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    18%{
        left: 62.5%;
        bottom: 25%;
        border-radius: 0 0 100% 100%;
        height: 25%;
        width: 25%;
        background: <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    20%{
        left: 66.25%;
        bottom: 25%;
        border-radius: 50%;
        height: 32.5%;
        width: 32.5%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    25%{
        left: 62.5%;
        bottom: 12.5%;
        border-radius: 50%;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    30%{
        left: 62.5%;
        bottom: 12.5%;
        border-radius: 50%;
        height: 25%;
        width: 25%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    35%{
        left: 84%;
        bottom: 0%;
        border-radius: 999px;
        height: 10%;
        width: 14%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    50%{ height:10%; }
    55%{ height:100%; }
    70%{ height: 10%; }
    75%{ height:100%; }
    85%{
        left: 84%;
        bottom: 0%;
        border-radius: 999px;
        height: 25%;
        width: 14%;
        background:<?php echo esc_attr($divi_pxpre_preloader_color); ?>;
    }
    90%{
        left: 57.5%;
        bottom: 17.5%;
        border-radius: 100%;
        height: 25%;
        width: 25%;
    }
    97%{
        left: 57.5%;
        bottom: 17.5%;
        border-radius: 100%;
        height: 25%;
        width: 25%;
        box-shadow: none;
    }
    100%{
        box-shadow: -3px -3px 5px -5px <?php echo esc_attr($divi_pxpre_preloader_color); ?>;
        border-radius: 100%;
        left: 100%;
        bottom: -50%;
        height: 50%;
        width: 50%;
    }
}
</style>