Coder Social home page Coder Social logo

meteor-ladda-bootstrap's Introduction

Ladda for Bootstrap 3

Buttons with built-in loading indicators, effectively bridging the gap between action and feedback.

Check out the demo page.

Instructions

Please see the demo page for the details: (http://msurguy.github.io/ladda-bootstrap/).

HTML

Ladda buttons must be given the class ladda-button and the button label needs to have the ladda-label class. The ladda-label will be automatically created if it does not exist in the DOM. Below is an example of a button which will use the expand-right animation style.

<button class="ladda-button" data-style="expand-right"><span class="ladda-label">Submit</span></button>

Buttons accepts three attributes:

  • data-style: one of the button styles, full list in demo [required]
  • data-color: green/red/blue/purple/mint
  • data-size: xs/s/l/xl, defaults to medium
  • data-spinner-size: 40, pixel dimensions of spinner, defaults to dynamic size based on the button height
  • data-spinner-color: A hex code or any named CSS color.

JavaScript

If you will be using the loading animation for a form that is submitted to the server (always resulting in a page reload) you can use the bind() method:

// Automatically trigger the loading animation on click
Ladda.bind( 'input[type=submit]' );

// Same as the above but automatically stops after two seconds
Ladda.bind( 'input[type=submit]', { timeout: 2000 } );

If you want JavaScript control over your buttons you can use the following approach:

// 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();

All loading animations on the page can be stopped by using:

Ladda.stopAll();

Browser support

The project is tested in Chrome and Firefox. It Should Work™ in the current stable releases of Chrome, Firefox, Safari as well as IE9 and up.

License

MIT licensed

Copyright (C) 2013 Hakim El Hattab, http://hakim.se

meteor-ladda-bootstrap's People

Contributors

joshdellay avatar xc8tlik avatar chadokruse avatar

Stargazers

吴红军 avatar David Lynch avatar  avatar

Watchers

James Cloos avatar David Lynch avatar  avatar

Forkers

xc8tlik kevb

meteor-ladda-bootstrap's Issues

Please update

This version is a bit behind the current production version of the original code. It would be nice to have the most up to date version as a package.

Issue Regarding Meteor Load Sequence

I'm not sure whether this is just a matter of my own setup, but in my case, the load order for the JavaScript files was crucial.

It was necessary for spin.js to load first followed by ladda.js.

When using unmodified meteor-ladda-bootstrap package, I encountered:

uncaught TypeError: undefined is not a function

in createSpinner when the function attempts to instantiate Spinner.

By renaming spin.js to _spin.js I was able to force the system to load _spin.js first. In my case, this resolved the issue. BTW I'm using Meteor 1.0.4.1 (bleeding edge at the time of this writing).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.