Giter Club home page Giter Club logo

loader.js's Introduction

loader.js

loaderjs is a little library for simple animations, which are displayed while a webpage is loading.

Installation

The installation of the loaderjs plugin is quite simple, although there are two ways to go:
bower
bower install loaderjs
if this was successfull, you can link the loaderjs-script like that
<script src="bower_components/loaderjs/loader.js"></script>
for more information, visit bower
github clone
git clone https://github.com/mspringsits/loader.js.git
after you have cloned the project to your disk, you can simply take the loader.js-file and copy it to your own project.
for more information, visit git
Attention: loaderjs requires JQuery!
<script src="bower_components/jquery/dist/jquery.min.js"></script>

Usage

Generally there a three methods, that have to be called, that loaderjs works properly:

  • Loader.preload();
  • Loader.main();
  • Loader.finish();
    All methods have to be given to make loaderjs work properly!

####Loader.preload();#### The preload method is used to handle background(graphically) while the page is loading.
Several backgrounds are implemented from begin, which can be given with a string parameter:
preload([background], [parameter]); background(string):

  • "no-display": nothing is displayed, the page will be empty
  • "black-background": a black background will be displayed
  • "custom-background": a custom background-color will be displayed; the color has to be transmitted with the parameter as string
  • "alpha": the opacity of the loading page will be set to 0.5; if a custom opacity is wanted, you must use the parameter as a float-number

####Loader.main();#### The main method is the 'core' of loaderjs.
It is used to manage the effects that are displayed while the page is loading.
parameters:
main([action], [parameter]); action(string):

  • "standard": a simple standard spinner
  • "custom": insert your custom html while the page is loading; the html has to be provided to the parameter as a string
  • "dots": a simple loader with dots, which are displaying the progress
  • "spectrum": a growing and shrinking circle, displaying the loading progress
  • "futuristic": a very futuristic loader
  • "text": a custom text, provided as string through parameter will be displayed

####Loader.finish();#### The finish method handles what has to be done when the site has loaded properly.
parameters:
finish([action], [parameter]): action(string):

  • "fade": the content will be faded back in, the fade-time can be handled with the parameter given as a number in milliseconds; the default value will be one second

if no action is provided, the content will be displayed without any effects
for testing purposes of the Loader.main()-method you can simply outcomment Loader.finish();

Note that all three methods have to be used for a proper use!

Examples

fancy dot loader with black background

<script>
    $(document).ready(function() {
        Loader.preload("black-background");
        Loader.main("dots");
        Loader.finish();
    });
</script>

futuristic spinner with no background

<script>
    $(document).ready(function() {
        Loader.preload("no-display");
        Loader.main("futuristic");
        Loader.finish("fade", 1500);
    });
</script>

loader.js's People

Contributors

mspringsits avatar mic0905 avatar

Watchers

Stefan Bödenauer avatar

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.