/javascript-sparkly-div

Add moving stars (or anything else) on any div

Primary LanguageJavaScript

javascript-sparkly-div

Add moving stars (or anything else) on any div

In this readme...

In a nutshell

  • All you really need is the js file sparkly.js
  • Demo
  • Or you can see how it works in the src folder

Usage

Basic command is `new mySparkle( ).init( elem_selector , number_of_stars , options );`, with `options` being JSON-parsed CSS properties.

Examples

In your html file, just add ``` <script> new mySparkle( ).init( ".mySparkleDiv" , 300 ); </script> ``` Or even ``` <script> var sparks = new mySparkle( ); sparks.init( ".mySparkleDiv" , 150 , { "width" : "5px", } ); // creates 150 stars with a 5px width, in the div(s) with the "mySparkleDiv" class </script> ``` If no element is specified, then it is assumed that the stars have to be added to the `body`.

Dependencies

This requires jQuery to have been loaded first. You can add `<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>` in the head of your HTML file.