Giter Site home page Giter Site logo

timzzx / jqlouds Goto Github PK

View Code? Open in Web Editor NEW

This project forked from enricodeleo/jqlouds

0.0 1.0 0.0 177 KB

:cloud: An awesome yet simple plugin for jquery that let's you create clouds on the fly.

Home Page: http://enricodeleo.github.io/jqlouds/

License: MIT License

JavaScript 65.31% HTML 19.15% CSS 15.54%

jqlouds's Introduction

jQlouds logo

An awesome yet simple plugin for jquery that let's you create clouds on the fly.

Getting Started

With Bower

You can include jQlouds in your project with bower with:

bower install jqlouds --save

npm

npm install jqlouds

Manual

Download the package, unzip it and include the preferred script within /dist (minified or not) after the jQuery library (unless you are packaging scripts somehow else).

In your web page:

<script src="jquery.js"></script>
<script src="dist/jquery.jqlouds.min.js"></script>

Documentation

Basic usage

As you can see in the getting started section, you just need to pass a jquery selector and call the plugin in order to get the job done.

You can generate multiple clouds on the same page, each element will be filled with random static clouds. Note that the selected element will be relatively positioned in order to accomodate absolutely positioned clouds.

$('#sky1, #sky2').jQlouds();

Height of the sky

Unlike the real sky, here we know exactly how much it is height: minimu height is given automatically based on the height of the biggest cloud. You can give a different height to the element throug the plugin itself.

via css

<div id="sky" style="height:223px;"></div>
<script>
jQuery(function($) {
  $('#sky').jQlouds();
});
</script>

via jquery

<div id="sky"></div>
<script>
jQuery(function($) {
  $('#sky').jQlouds({ skyHeight: 223 });
});
</script>

Animation

Sometimes the wind blows and clouds became to move around the sky, isn't it? Well, you can turn on your very personal wind just by setting it to true:

$('#sky').jQlouds({
  wind: true
});

note about performances

jQlouds relies on jQuery's .animate() to perform its animations. Since this is something quite heavy, animations come disabled by default. I'll try to improve this feature with CSS3 animations. If you'd like to contribute feel free to fork this project and submit a pull request.

Number of clouds

The amount of clouds is chosen randomly between 20 and 30.

You can adjust these values settings minClouds and maxClouds parameters:

$('#sky').jQlouds({
  minClouds: 5,
  maxClouds: 10
});

Maximum clouds' size

The default image provided (it is served as base64 image so you won't need to upload anything but the plugin) is 227x96 px. All the clouds generated are randomly sized less or equal to that size. You can adjust this behavior as per your needs with:

$('#sky').jQlouds({
  maxWidth: 113,
  maxHeight: 48,
});

Customize the cloud

If you don't like my cloud (how dare you! :P) you just need to change the src property when calling the plugin, like so:

$('#sky').jQlouds({
  src: 'path/to/image.png',
});

Options

These are all the current options supported by jQlouds, as we've seen above:

options = {
  src: 'images/cloud.png', // path to image, the default is a base64 (you can see the actual string in sources)
  maxWidth: 227, // max image's width
  maxHeight: 96, // amx image's height
  minClouds: 20, // minimum amount of clouds
  maxClouds: 30, // maximum amount of clouds
  skyHeight: null, // height of the container element
  wind: false // animate clouds, default is false
};

$('#sky').jQlouds(options);

Examples

You can see this plugin in action here.

ToDo

✔️ Introduce CSS3 animations with jQuery.animate() fallback

✔️ Release on bower registry

✔️ Release on jQuery Plugins registry (until 0.2.3 since the registry is now deprecated)

✔️ Release on npm as per jQuery new policy

✖️ SVG images with png fallback

✖️ ? (suggestion welcomed)

Release History

  • v1.0.0 - 27/01/15
    • check for 3D support and apply jQyery.animate() as a fallback if not supported
    • bumped version to 1.0.0 on bower and jquery
  • v0.2.3-css3 - 27/01/15
    • alternative version that leverage hardware acceleration via CSS3 and translate3d (see the css3 branch)
  • v0.2.3 - 06/07/14
  • v0.2.0 - 06/07/14
    • improved clouds' positioning
    • introduced configurable container's height
    • written an hopefully decent README.md
  • v0.1.0 - 05/07/14
    • first release

jqlouds's People

Contributors

enricodeleo avatar

Watchers

淡淡忧愁 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.