1.16.0 • Published 9 years ago

clickspark.js v1.16.0

Weekly downloads
6
License
MIT
Repository
github
Last release
9 years ago

ClickSpark.js

ClickSpark.js is a javascript utility that adds beautiful particle effects to your javascript events.
Add image-files as single particles and configure where and when a particle fountain should be fired.
TEST THE DEMO

Install

Usage

Automatic click binding (default particle effect)

use jQuery to add ClickSpark to HTML-elements:

$('h1').clickSpark();

On a click on the h1 the default sparkling effect will be fired.

Automatic configured click binding (customized particle effect)

use jQuery to add ClickSpark to HTML-elements. Configure particle attributes for example like this:

$('h1').clickSpark({     
    particleImagePath: '../particle.png',     
    particleCount: 35,     
    particleSpeed: 12,     
    particleSize: 12,
    particleRotationSpeed: 20,
    particleDuration: 400,  
    animationType: 'explosion',
    callback: function() { /*do something, follow href for example*/ } 
});
Attributedefaulttype
particleImagePathstring
particleCount35int
particleSpeed12int
particleSize12int
particleRotationSpeed0int
particleDuration400int
animationType'explosion'string
callbackfunc()

animationTypes:

  • explosion
  • splash
  • falloff
  • blowright
  • blowleft

Independent particle binding (default particle effect)

use jQuery to fire ClickSpark independently for example like this:

$(document).ready(function () {
    $('button').click(function () {
        clickSpark.fireParticles($('.sparklingDiv'));
    });
});

The particles will be targeted to the center position of the HTML-element with the className ".sparklingDiv". So the particle target can be placed everywhere via CSS.

Global particle configuration

use these ClickSpark methods to set the attributes for your particle effect:

    clickSpark.setParticleCount(50);
    clickSpark.setParticleSize(12);
    clickSpark.setParticleSpeed(12);
    clickSpark.setParticleImagePath('../particle.png');
    clickSpark.setParticleRotationSpeed(20);
    clickSpark.setParticleDuration(400);
    clickSpark.setAnimationType('explosion');
    clickSpark.setCallback: (function() { /*do something, follow href for example*/ }); 

Dependencies

  • jQuery

Browser Support

Browser
Version4.09.02.03.19.0
1.16.0

9 years ago

1.15.0

9 years ago

1.14.0

9 years ago

1.13.0

9 years ago

1.12.0

9 years ago

1.11.0

9 years ago

1.10.0

9 years ago

1.9.0

9 years ago

1.8.0

9 years ago

1.7.0

9 years ago

1.5.0

9 years ago

1.4.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago