Fixed a bug

Fixed a bug regarding JS crashing when you're clicking elements. It appeared when I tried out the script directly from your example code. 

Didn't edit the minified version, but I guess you have something/someone to do that for you :-)