1.0.1 • Published 3 years ago

jquery.preloadinator v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

preloadinator

A super-lightweight preloader plugin, powered by jQuery & CSS :zap:

Dependencies

Preloadinator requires the dependencies listed below.

Quickstart

  1. Write HTML markup for your preloader
<div class="preloader js-preloader">
</div>
  1. Write CSS styling for the preloader & include this into your HTML file
.preloader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #60D7A9;
}
  1. Add jQuery & preloadinator.min.js right before your closing <body> tag
<script src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="dist/jquery.preloadinator.min.js"
  1. Initialise your preloader & include this into your HTML file
$('.js-preloader').preloadinator();
  1. Kick back & relax :beer:

Options

OptionTypeDefaultDescription
scrollbooleanfalseEnable/disable scrolling when the preloader is displayed
minTimeinteger0Minimum amount of time to display preloader (in milliseconds)
animationfunctionfadeOutAnimation used to remove the preloader when the page has loaded
animationDurationinteger400Duration of animation (in milliseconds)

Use the options above like so:

$('.js-preloader').preloadinator({
	scroll: false,
	minTime: 2000,
	animation: slideUp,
	animationDuration: 600
});

Callbacks

CallbackDescription
afterDisableScrollThis callback is fired after scrolling is disabled (if scroll option is set to false)
afterEnableScrollThis callback is fired after scrolling is enabled (if scroll option is set to false)
afterRemovePreloaderThis callback is fired after the preloader is removed from the view

Use the callbacks above like so:

$('.js-preloader').preloadinator({
	afterDisableScroll: function() {
		alert('Scrolling has just been disabled.');
	},
	afterEnableScroll: function() {
		alert('Scrolling has just been enabled.');
	},
	afterRemovePreloader: function() {
		alert('The preloader has just been removed.');
	}
});

Happy coding! 🤖

akbarbuneri

1.0.1

3 years ago

1.0.0

3 years ago