Design patterns that serve as basic building blocks.
Simple jQuery plugin to show visual feedback when loading data or any action that would take time
Name | Version | License | Repository |
---|---|---|---|
isLoading | 1.0.6 | MIT | https://github.com/hekigan/is-loading |
This is the most basic setup. Just use $('selector').loader();
and you are done for the setup.
When your action (data loading, etc…) is done, just call $('selector').loader('hide');
and you are done.
$('selector').loader();
Stop:
$('selector').loader('hide');
This demo shows how to show the loading message inside the target.
$('selector').loader({ position: 'right' });
This demo shows how to show the loading message inside the target.
$('selector').loader({ position: 'inside' });
$.loader();
$('selector').loader({ position: 'overlay' });
$('selector').loader({ text: 'Sending...' });
If you want to disable some extra tags/input/etc… while the loading is active, you can use the disableOthers[]
option.
$('selector').loader({
text: 'Sending',
disableOthers: [
$('#demo .form-control'),
$('#demo .btn')
]
});
Name | Type | Default | Description |
---|---|---|---|
position | boolean | block |
loader 출력 위치 및 형태 설정.
block | right | inside | overlay 3 가지 사용 가능
|
text | string | null | loader 출력시 표시되는 문구 |
theme | string | default | Theme를 설정 할 수 있다. |
tpl | string |
Loader template |
|
disableSource | boolen | true | loader 출력시 주변 엘리먼트에 disabled attribute 또는 class를 추가 |
disableOthers | Array | [] | 설정된 엘리먼트들에 disabled attribute 또는 class를 추가 |
defaults = {
'position': 'block', // block | right | inside | overlay
'text': '', // Text to display next to the loader
'theme': 'default', // loader CSS theme
'tpl': '<span class="loader-wrapper %wrapper% %theme%"><i class="loader">Loading...</i>%text%</span>',
'disableSource': true, // true | false
'disableOthers': []
};
<style>
.loader-overlay {...}
.loader-overlay .loader-wrapper.myLoader {...}
</style>
$('selector').loader({
theme: 'myLoader',
tpl: '..'
});
$(".btn").tap(function() {
$('#myModal').modal('show');
$("#myModal p").html("");
$("#myModal .content").loader({
text: "Loading...",
position: "overlay"
});
setTimeout(function() {
$("#myModal .content").loader("hide");
$("#myModal p").html("Hello World");
$.notify("Content Loaded")
}, 1000);
});
$(".btn").tap(function() {
$('#page-target').page({start: "#page-start"});
$("#page-target p").html("");
$("#page-target .content").loader({
text: "Loading...",
position: "overlay"
});
setTimeout(function() {
$("#page-target .content").loader("hide");
$("#page-target p").html("Hello World");
$.notify("Content Loaded");
}, 1000);
});