loaders | Magento UI Library
Loaders
A page loader is an animation a visitor sees while the page or an element is loaded. During this time a page is blocked with overlay.
Default loader markup
<div id="example1" class="loader" data-text="Please wait..." style="display: none;">
</div>
.loader {
.lib-loader();
}
Default loader variables
| Mixin variable |
Default value |
Allowable values |
Comment |
| @_loader-overlay-background-color |
rgba(255, 255, 255, .5) |
'' | false | value |
Loader overlay background color |
| @_loader-overlay-z-index |
9999 |
'' | false | value |
Loader overlay background z-index |
| @_loader-icon-width |
160px |
'' | false | value |
Loader icon width |
| @_loader-icon-height |
160px |
'' | false | value |
Loader icon height |
| @_loader-icon-background-color |
transparent |
'' | false | value |
Loader icon background color |
| @_loader-icon-background-image |
url('@{baseDir}images/loader-2.gif') |
'' | false | value |
Loader icon ackground image |
| @_loader-icon-background-position |
50% 50% |
'' | false | value |
Loader icon background position |
| @_loader-icon-border-radius |
5px |
'' | false | value |
Loader icon border radius |
| @_loader-icon-padding |
'' |
'' | false | value |
Loader icon icon padding |
| @_loader-text |
false |
'' | false | value |
Loader text presence |
| @_loader-text-color |
@primary__color |
'' | false | value |
Loader text color |
| @_loader-text-font-size |
@font-size__base |
'' | false | value |
Loader text font size |
| @_loader-text-font-family |
@font-family__base |
'' | false | value |
Loader text font family |
| @_loader-text-font-weight |
@font-weight__regular |
'' | false | value |
Loader text font weight |
| @_loader-text-font-style |
@font-style__base |
'' | false | value |
Loader text font style |
| @_loader-text-padding |
130px 0 0 |
'' | false | value |
Loader text padding |
Loading
Loading is an animation a visitor sees while a certain block is loaded. In this case only this block is locked by an overlay, not the whole page.
.loading {
.lib-loading();
}
Loading default variables
| Mixin variable |
Default value |
Allowable values |
Comment |
| @_loading-background-color |
@loader-overlay__background-color |
'' | false | value |
Loading overlay background color |
| @_loading-background-image |
@loader-icon__background-image |
'' | false | value |
Loading overlay background z-index |
"+a.textContent):g=m,f.setAttribute("src",g);var i=function(){f.contentDocument.body.innerHTML=this.value,h(f,"getHeight")};a.addEventListener("keypress",i),a.addEventListener("keyup",i),a.parentNode.insertBefore(d,a)},p=function(a){var b=document.createElement("div");b.className="preview-code",b.style.position="absolute",b.style.left="-9999px",j.appendChild(b);var c=parseInt(window.getComputedStyle(a).getPropertyValue("max-height"),10),d=function(a){b.textContent=this.value+"\n";var d=b.offsetHeight+2;d>=c?this.style.overflow="auto":this.style.overflow="hidden",this.style.height=b.offsetHeight+2+"px"};a.addEventListener("keypress",d),a.addEventListener("keyup",d),d.call(a)},q=function(){var b=j.getElementsByClassName("settings")[0],c=j.getElementsByClassName("resizeable"),d=30,e=function(b){document.cookie="preview-width="+b,a(c,function(a){b==="auto"&&(b=a.parentNode.offsetWidth),a.style.width=b+"px",h(a.getElementsByTagName("iframe")[0],"getHeight")})},i=f(document.cookie)["preview-width"];if(i){e(i),g(b.getElementsByClassName("is-active"),"is-active");var k=b.querySelector('button[data-width="'+i+'"]');k&&k.classList.add("is-active")}window.addEventListener("message",function(a){if(a.data==null||!a.source)return;var b=a.data,c=document.getElementsByName(a.source.name)[0];b.height!=null&&c&&(c.parentNode.style.height=b.height+d+"px")},!1),b&&c.length>0&&(b.hidden=!1,b.addEventListener("click",function(a){var c=a.target.tagName.toLowerCase(),d;if(c==="button")d=a.target;else{if(c!=="svg")return;d=a.target.parentNode}a.preventDefault(),g(b.getElementsByClassName("is-active"),"is-active"),d.classList.add("is-active");var f=d.dataset.width;e(f)}))}}()})()