Astra_Enqueue_Scripts::set_header_break_point_early()

Output an early inline script immediately after <body> opens to apply ast-header-break-point before the header is painted, preventing FOUC on mobile with the inline Logo + Site Title + Tagline layout.


Description


Return

(void)


Source

File: inc/core/class-astra-enqueue-scripts.php

		public function set_header_break_point_early() {
			// Skip on AMP — it handles its own layout.
			if ( astra_is_amp_endpoint() ) {
				return;
			}
			$break_point = astra_header_break_point();
			?>
			<script>
			(function(){var w=document.documentElement.clientWidth;if(w>0&&w<=<?php echo absint( $break_point ); ?>){document.body.classList.add('ast-header-break-point');document.body.classList.remove('ast-desktop');}})();
			</script>
			<?php
		}

Changelog

Changelog
Version Description
4.13.1 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.