• Resolved sonisitez

    (@sonisitez)


    If i have inline JS like this, what keyword i must input to Flying script to delay this js? Thankyou.

    <div class="adace-loader adace-loader-<?php echo esc_attr( $unique_id );?>">
    		<script>
    			(function ($) {
    			var $self = $('.adace-loader-<?php echo esc_attr( $unique_id );?>');
    			var $wrapper = $self.closest('.adace-slot-wrapper');
    
    			"use strict";
    			var adace_load_<?php echo esc_attr( $unique_id );?> = function(){
    				var viewport = $(window).width();
    				var tabletStart = <?php echo esc_attr( $tablet_start );?>;
    				var landscapeStart = <?php echo esc_attr( $landscape_start );?>;
    				var tabletEnd = <?php echo esc_attr( $tablet_end );?>;
    				var content = '<?php echo esc_attr( $content );?>';
    				var unpack = true;
    				if(viewport<tabletStart){
    					<?php
    					if( strpos( $html, 'adace-hide-on-mobile' ) ) {
    						echo 'unpack = false;';
    					}
    					?>
    					if ($wrapper.hasClass('.adace-hide-on-mobile')){
    						$wrapper.remove();
    					}
    				}
    				if(viewport>=tabletStart && viewport<landscapeStart){
    					<?php
    					if( strpos( $html, 'adace-hide-on-portrait' ) ) {
    						echo 'unpack = false;';
    					}
    					?>
    					if ($wrapper.hasClass('.adace-hide-on-portrait')){
    						$wrapper.remove();
    					}
    				}
    				if(viewport>=landscapeStart && viewport<tabletEnd){
    					<?php
    					if( strpos( $html, 'adace-hide-on-landscape' ) ) {
    						echo 'unpack = false;';
    					}
    					?>
    					if ($wrapper.hasClass('.adace-hide-on-landscape')){
    						$wrapper.remove();
    					}
    				}
    				if(viewport>=tabletStart && viewport<tabletEnd){
    					<?php
    					if( strpos( $html, 'adace-hide-on-tablet' ) ) {
    						echo 'unpack = false;';
    					}
    					?>
    					if ($wrapper.hasClass('.adace-hide-on-tablet')){
    						$wrapper.remove();
    					}
    				}
    				if(viewport>=tabletEnd){
    					<?php
    					if( strpos( $html, 'adace-hide-on-desktop' ) ) {
    						echo 'unpack = false;';
    					}
    					?>
    					if ($wrapper.hasClass('.adace-hide-on-desktop')){
    						$wrapper.remove();
    					}
    				}
    				if(unpack) {
    					$self.replaceWith(decodeURIComponent(content));
    				}
    			}
    			if($wrapper.css('visibility') === 'visible' ) {
    				adace_load_<?php echo esc_attr( $unique_id );?>();
    			} else {
    				//fire when visible.
    				var refreshIntervalId = setInterval(function(){
    					if($wrapper.css('visibility') === 'visible' ) {
    						adace_load_<?php echo esc_attr( $unique_id );?>();
    						clearInterval(refreshIntervalId);
    					}
    				}, 999);
    			}
    
    			})(jQuery);
    		</script>
    	</div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘KeyWord Javascript’ is closed to new replies.