Hello everyone. Loader is very useful for you when you make some Ajax request. It is very important when you develop a website.
You can define ‘mage/loader’ in your js to call the widget.
The loader widget has the following options:
The URL to the loader image. This image is displayed when the widget is active; that is, between the ajaxSend and ajaxComplete events.
- Type: String
- Default value: No image by default.
HTML wrapper for the output, or a DOM element selector.
'<div class="loading-mask" data-role="loader">' +
'<div class="loader">' +
'<img alt="<%- data.texts.imgAlt %>" src="<%- data.icon %>">' +
'<p><%- data.texts.loaderText %></p>' +
An object that contains translations for loader text:
texts.loaderText: The text that is displayed under the loader image.
- Default value: ‘Please wait…’
texts.imgAlt: The text that is set as the alt attribute value of the loader image.
- Default value: ‘Loading…’
- processStart: Display the loader. Can be triggered on any page element.
- processStop: Hide the loader. Can be triggered on any page element.
The steps I mention above is the shortest process for you to Loader Widget in Magento 2 . With this guide, you can manage the Loader Widget in Magento 2 easily. Every store has a Loader Widget in Magento 2 with many attributes.
Thank you for reading this post and see you in other posts from Magestore!