• Stars
    star
    721
  • Rank 62,814 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 13 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Version of the QueryLoader by Gaya Kessler. Preload images with ease.

QueryLoader2

QueryLoader2 serves the main purpose of pre-loading the images on your website by showing an overlay and a loading bar. It automatically fetches all your images and background images and pre-loads them before showing the web page.

Code Climate Build Status

Compatibility

QueryLoader currently works in IE version 9+, Chrome, Safari and Firefox.

No dependencies, so no jQuery / Zepto / MooTools required.

Read the full post here: http://blog.gaya.ninja/articles/queryloader2-preload-your-images-with-ease/

View example of how QueryLoader2 works.

Example usage

Include the queryloader2.min.js script (which is in the root of this repository) in the head section of your webpage.

<script src="queryloader2.min.js" type="text/javascript"></script>

Create a QueryLoader2 object like this for example:

<script type="text/javascript">
    window.addEventListener('DOMContentLoaded', function() {
        QueryLoader2(document.querySelector("body"), {
            barColor: "#efefef",
            backgroundColor: "#111",
            percentage: true,
            barHeight: 1,
            minimumTime: 200,
            fadeOutTime: 1000
        });
    });
</script>

Use with NPM / Browserify

First install QueryLoader as a dependency in your project:

npm install queryloader2 --save-dev

Use it in a node / browserify project:

var QueryLoader2 = require("queryloader2");

var loader = QueryLoader2(document.querySelector("body"), {
	barColor: "#efefef",
	backgroundColor: "#111",
	percentage: true,
	barHeight: 1,
	minimumTime: 200,
	fadeOutTime: 1000
});

jQuery usage

Include jQuery and queryloader2.min.js scripts in the header.

<script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="queryloader2.min.js" type="text/javascript"></script>

Call QueryLoader in $(document).ready() like this:

$(document).ready(function () {
	$("body").queryLoader2();
});

Install using Bower

bower install queryloader2

Basic usage

QueryLoader2(element, options);

Options

backgroundColor string background color of the loader (in hex). Default: "#000"

barColor string background color of the bar (in hex). Default: "#FFF"

barHeight int height of the bar in pixels. Default: 1

minimumTime int time in miliseconds which the loading has to run. If time has not passed the animation will still show. Default: 500

maxTime int maximum time in milliseconds the loader may take. Go past this time and the loader with automatically close. Default: 10000

fadeOutTime int time in miliseconds it takes for the overlay to fade out at the end. Default: 1000

deepSearch boolean set to true to find ALL images with the selected elements. If you don't want queryLoader to look in the children, set to false. Default: true

percentage boolean Set to true to enable percentage visualising. Default: false

onComplete function this function is called once the loading and animation are completed. Default: none

onProgress function this function is called when an image is loaded. Get parameters percentage, imagesLoaded, totalImages. Default: none

More Repositories

1

Retina-Sprites-for-Compass

Allow to use sprites in retina with Compass.
CSS
162
star
2

Fullscreen-Background-jQuery-plugin

Fullscreen background is a small jQuery plugin that allows you to create fullscreen background.
JavaScript
83
star
3

functional-snake

Snake clone written in JavaScript using functional programming
JavaScript
44
star
4

jQuery--Keep-the-Rhythm

Keep a nice vertical rhythm with elements that don't have one.
JavaScript
19
star
5

gaya.pizza

Public repository of Gaya Kessler's blog
SCSS
10
star
6

redux-listeners

Redux middleware which allows listening in on and handling of dispatched actions
JavaScript
10
star
7

MarkPress

Maintain a Markdown journal in this WordPress takeover App
Ruby
8
star
8

Locale-Storager

A little script that helps in managing the localeStorage of the browser.
6
star
9

svg-inliner

Creates inline HTML <svg> from an external SVG (sprite) in an <img /> tag
JavaScript
5
star
10

testing-javascript

Testing JavaScript using BrowserSync, Mocha and PhantomJS
JavaScript
4
star
11

Compass-Boilerplate

Boilerplate folders and files to start using Sass and Compass
Ruby
4
star
12

create-my-run

Generate your next run
TypeScript
4
star
13

mini-js-starter

Very minimal starter to kickstart JavaScript projects. No frameworks, plain npm tasks.
JavaScript
3
star
14

opensupport

Discover the top maintainers of the dependencies you use
JavaScript
3
star
15

rxjs-games

A collection of stupid RxJs powered games to learn more about the library
TypeScript
2
star
16

frankensoil

C++
2
star
17

Socketmon

A Websocket monitoring and proxy server
TypeScript
2
star
18

gulp-timber-example

An example how you can use Gulp + Twig + Timber data.
JavaScript
2
star
19

fermenter

TypeScript
1
star
20

react-to-redux-demo

Demo demonstrating how to go from basic react to redux
HTML
1
star
21

dekode-react-class

JavaScript
1
star
22

resume

Resume (CV) containing work experience, education and skills.
1
star
23

multipong

MULTI PONG
TypeScript
1
star
24

programming-challenges

Programming challenges we like to do
JavaScript
1
star
25

Formable-for-WordPress

Integrate Formable into WordPress
1
star
26

fetch-with-react-hooks

Example code of how you can use React to resolve data async with hooks
JavaScript
1
star
27

remote-games

TypeScript
1
star
28

mockup-data-middleware-with-connect

Example project how to serve static mockup data to your front-end using Connect and Grunt
JavaScript
1
star
29

jQuery-helper-functions

A collection of functions not included in the default jQuery package, but oh so handy!
JavaScript
1
star