Ryan Kinal
100 E. St. Clair St.
Warren, PA 16365

Google ProfileTwitter: @IndigloMouth

Hello, JS, My Old Friend

I've recently started a full-time position doing web development. It pays well (and regularly), I have benefits (well, I will at the beginning of next month), and it's a really laid-back environment. There's very little in the way of dress code, which suits me well, and there's something called "Beer Thirty" every Friday. I'll let you guess what that is.

But honestly, one of my favorite things about it so far was that I was required to use JavaScript on a project. Not jQuery, not prototype.js, or anything of that sort. Just pure JavaScript. It's been a while.

The assignment was to create a lightbox. Something that could have been done in seconds with jQuery, considering all the lightbox-style plugins available. But after considering the pros (it's pretty, and easy) and the cons (it's two fairly large files to load), my supervisor told me to go ahead with a pure JS solution.

And I did.

And it was fun.

It's been a long time since I've written anything purely in JavaScript, but I got right back into it. I used closures, I used document.getElementById(), I created elements on the fly, I styled them, and I even did a slick fade in with setTimeout. I had a working lightbox in about 150 lines of code (plus, I suppose, addEvent() and removeEvent() - the John Resig versions). After some testing, tweaking, new features, and comments, it reached around 300 lines, but it's still a slick little piece of software.

At one point during development, I learned that one of my coworkers is using jQuery for the main navigation on the site, so we'll be loading jQuery anyway, but hey, my lightbox is now live (in a multi-variant testing sort of way), and his menus aren't yet. I'm actually helping him out with them later today.

Now, I'm not actually sure on the legals of this stuff, so I won't provide a link now, but suffice to say, it looks good. And it feels good to get back to the basics of JavaScript. I love the language, and while jQuery is nice, it just doesn't feel the same.

Welcome back, JavaScript. I hope you stick around.

Are you human? (enter yes if so)