There's a great little bit of falling confetti generating JavaScript that I found on CodePen. It's invoked by a simple:
(function() {
// Confetti code here
}).call(this);
It works great, but I wish to manually invoke it at a certain point.
I've tried placing it in a function, like so (removing the two wrapping lines above):
function confetti() {
// Confetti code here
}
And then calling that function, but nothing is happening. Can't see why. The code in question can be seen here: http://codepen.io/linrock/pen/Amdhr
UPDATE
It appears my code was triggered fine. It had nothing to do with it being an anonymous function at all. For some reason it only springs to life when the browser is resized -- which is another issue entirely. Weird.
Not sure what to with this question now -- the solutions here have nothing to do with the actual problem. (The problem as described never existed in the first place :-/ )