Loader

The ska-theme’s “Loading” preset can be applied to produce an overlay with a loading spinner.

Loading preset is globally loaded on the front end and applied to the following CSS selectors by default:

  • .ska-preset--ska-theme--loading
  • :is(.wp-element-button, .wp-block-button__link, .ska-preset--ska-theme--button).loading
  • .blockUI.blockOverlay

Additional custom selectors can be added using the following filter:

Adding a custom loading preset selectorPHP
add_filter('ska_theme_loading_selectors', function($selectors) {
	$selectors[] = 'form[data-submitting="true"]';
	return $selectors;
});

The loading spinner appearance can be customized with Tailwind classes by editing the Loading preset under ska-blocks -> Options -> Presets -> Loading.

Integrations

  • Contact Form 7 – The loading preset is applied to contact forms when submitting.
  • WooCommerce – The loading preset is used on AJAX add to cart buttons, when updating cart contents, when loading mini cart and when submitting checkout data.
  • jQuery BlockUI Plugin – The loading preset overrides the default jquery-blockui loading state appearance, which is a commonly used jQuery plugin in WordPress plugins.

Examples

Loading preset applied to an Element

Content…

A button with .loading class

Loading preset with customizations

To change the loader size --loader-size CSS variable can be specified, such as [--loader-size:var(--spacing-14)]. Additionally you can edit the Loading preset directly, or add Tailwind classes to override its’ appearance on a case by case basis, such as after:border-4!, after:border-t-secondary!, after:[animation-duration:2s!important]:

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse facilisis orci dignissim, dignissim nisi in, interdum orci. Nullam a maximus nibh, lobortis accumsan lectus. Donec vel libero eu urna consectetur commodo eget in nunc. Nam tincidunt arcu eget lorem luctus auctor nec a tortor.