Điểm qua hakimel/Ladda: 7.8k sao trên GitHub, viết chủ yếu bằng JavaScript. Buttons with built-in loading indicators.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Buttons with built-in loading indicators, effectively bridging the gap between action and feedback.
Check out the demo page.
Installation
npm install ladda
Module bundling
Ladda 2.x is distributed as a standard ES6 module. Since not all browsers/environments support native
ES6 modules, it is recommended to use a bundler such as Rollup,
Parcel, or Webpack to create
a production-ready code bundle.
Usage
CSS
You will need to include ONE of the two style sheets in the /dist directory.
If you want the button styles used on the demo page, use the ladda.min.css file.
If you want to have the functional buttons without the visual style (colors, padding, etc.),
use the ladda-themeless.min.css file.
HTML
Below is an example of a button using the expand-right animation style.
When the JS code runs to bind Ladda to the button, the ladda-button class
will be automatically added if it doesn't already exist. Additionally, a span
with class ladda-label will automatically wrap the button text, resulting
in the following DOM structure:
data-spinner-size: pixel dimensions of spinner, defaults to dynamic size based on the button height
data-spinner-color: a hex code or any named CSS color, defaults to #fff
data-spinner-lines: the number of lines for the spinner, defaults to 12
JavaScript
Start by importing the Ladda module:
import * as Ladda from 'ladda';
The following approach is recommended for JavaScript control over your buttons:
// Create a new instance of ladda for the specified button
var l = Ladda.create(document.querySelector('.my-button'));
// Start loading
l.start();
// Will display a progress bar for 50% of the button width
l.setProgress(0.5);
// Stop loading
l.stop();
// Toggle between loading/not loading states
l.toggle();
// Check the current state
l.isLoading();
// Delete the button's ladda instance
l.remove();
To show the loading animation for a form that is submitted to the server
(always resulting in a page reload) the bind() method can be used:
// Automatically trigger the loading animation on click
Ladda.bind('button[type=submit]');
// Same as the above but automatically stops after two seconds
Ladda.bind('button[type=submit]', {timeout: 2000});
Note: when using the bind() method on buttons that are inside a form,
loading indicators will not be shown until the form is valid.
All loading animations on the page can be stopped by using:
Ladda.stopAll();
Browser support
Ladda has been tested in Firefox, Microsoft Edge, Chrome, and Internet Explorer 11.
It also Should Work™ in Safari and Internet Explorer 10.
hakimel/Ladda có 7.8k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/hakimel/Ladda. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
hakimel/Ladda có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho hakimel/Ladda. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
hakimel/Ladda còn đang phát triển không?
Commit gần nhất trên hakimel/Ladda là 5.0 năm trước (theo timestamp GitHub). Repo có 839 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
hakimel/Ladda là gì?
hakimel/Ladda (hakimel/Ladda) là dự án JavaScript trên GitHub. Theo mô tả gốc: Buttons with built-in loading indicators.
hakimel/Ladda viết bằng ngôn ngữ gì?
hakimel/Ladda chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về Ladda?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về Ladda.