Sparkle.js Examples

Sparkle.js Examples

Select an element with Children:

    document.querySelector("#example-1").sparkle();
        

Or select multiple Elements at once:

    document.querySelectorAll("#example-2>div").sparkle();
            

You can even use your own Strings or HTML

    var i = 0;
    document.querySelectorAll("#example-3>div").forEach(el => {
        i++
        el.sparkle({
            starsource: `${i}`,
            count: i
        });
    });
            

...and existing HTMLElements

    document.querySelectorAll("#example-4").sparkle({
        starsource: document.querySelector(".smile"),
        count: 16,
        minAge: 300,
        maxAge: 700
    });
    <div class="smile"
        style="width: 16px; height: 16px;line-height: 18px;font-size:16px; text-shadow: 0 0 8px yellow;">
        😊
    </div>
            
😊