Download
Demo
- Overview
- Documents
User Rating: 5/5 ( 1 votes)
Your Rating:
ClassyLoader is a jQuery plugin that lets your add beautiful and animated loaders to your website.
- Beautifully animated
- Cross-browser compatible
- Lightweight & ultra customisable
- Minimal coding required – simply include the Javascript file
- Easy to customize
1. INCLUDE JS FILES
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="js/jquery.classyloader.min.js"></script>
2. HTML
<canvas class="loader"></canvas>
3. JAVASCRIPT
$('.loader').ClassyLoader();
4. EXAMPLES
If you want to manually trigger the loader, you can do it like this:
var loader = $('.loader').ClassyLoader({ animate: false, percentage: 0 });
This will show the loader at 0%, but not animate it. You can animate the loader by using the draw()method and specify the percent to draw. For example:
$('.customtrigger').on('click', function() { loader.setPercent(100).draw(); });
You can also use this shortened version:
$('.customtrigger').on('click', function() { loader.draw(100); });
5. OPTIONS
- width - width of the loader in pixels, default is 200
- height - height of the loader in pixels, default is 200
- animate - whether to animate the loader or not, default is true
- percentage - percent of the value, between 0 and 100, default is 100
- speed - miliseconds between animation cycles, lower value is faster, default is 1
- showRemaining - show the remaining percentage (100% - percentage), default is true
- fontFamily - name of the font for the percentage, default is Helvetica
- showText - whether to display the percentage text, default is true
- fontSize - size of the percentage font, in pixels, default is 50px
- roundedLine - whether the line is rounded, in pixels, default is false
- diameter - diameter of the circle, in pixels, default is 80
- fontColor - color of the font in the center of the loader, any CSS color would work, hex, rgb, rgba, hsl, hsla, default is rgba(25, 25, 25, 0.6)
- lineColor - line color of the main circle, default is rgba(55, 55, 55, 1)
- remainingLineColor - line color of the remaining percentage (if showRemaining is true), default is rgba(55, 55, 55, 0.4)
- lineWidth - the width of the circle line in pixels, default is 5
6. METHODS
- show() - method that displays the initial loader but does not animate it. For ex. you can use theshow() method to display the loader at 0% and animate it by using the draw() method after you set the percent to load
- draw() - animate the loader to the specified percentage
- setPercent() - sets the percentage value of the loader, so you can use the draw() method afterwards to animate the loader
- getPercent() - returns the percentage value of the loader