Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Creating Floating Particles?

Hi there. I was wondering whether anyone had the know how on how to go about learning how to do this:

http://www.jongaulin.com/articles/firefly/

What I mean is, I simply don't want to copy and paste something other than jQuery. Not sure if I've made any sense but I'd appreciate some direction. Thanks!

1 Answer

Steven Parker
Steven Parker
229,657 Points

I'm not sure what you mean by "copy and paste". The place where you found this has a small download package for anyone wanting to use it.

This is a plug-in created by Dharmveer Motyar in 2011. The sources are available on github. The author has made several improvements since the version you linked to, as recently as last month.

Basically, this plug-in uses the JQuery .animate() function to update the locations of several absolutely-positioned image elements towards randomly-selected destinations. If you're interested in details of how it was done, you might download the source and study it.

If you haven't already taken it, the material in the Object-Oriented Javascript course might be useful for understanding the structure of this plug-in.