jQuery and Starbucks to the rescue
Posted 2013.01.21
Posted at 12:52pm EST; next post

Remember when I said I would make some unnoticeable changes to my code? That I was updating the PHP extension for MySQL that I use, but that the website would still look the same?

Well, a burst of productivity made me a liar.

For a long time, I've wanted to make my own photo galleries, the kind that the Lens blog and other respectable photo blogs use. The first iteration of my blog, in fact, used photo galleries, although I used the SimpleViewer plugin because I couldn't make one myself. Eventually, though, I started to like the look of blogs that simply showed all the photos on one page all at once, like at The Atlantic and the blogs of my old IDS colleagues James Brosher and Ryan Dorgan, and I moved to that design for a year and a half.

Once I started learning Python, though, I started to get a better hang of procedural code (I'm still trying to fully grasp object-oriented programming), and I began to visualize ways to put photos and captions in arrays and display them one at a time. These ideas were nebulous until I learned JavaScript, that great manipulator of static pages. With the help of the jQuery library, those nebular ideas suddenly gained clarity and structure, and last week I hammered some pre-code together.

The pre-code was definitely a rough draft. I had to make some new divs, and I had to condition the gallery's use on whether the entry was a simple blurb-and-photos post or one with photos mixed with words, and I had to force a reversion to the old style in entries that already use jQuery, and I tied it so much to the current styling and structure that it's not a universal plugin.

All that said, I made it completely on my own. After a marathon finish at Starbucks on Wednesday and some tweaks over the weekend, I am damn proud of this. It'll continue to get improved, and eventually, I'll make a universal version to possibly put on GitHub (go free software!) and use elsewhere on my website. If I'm really motivated, I'll make a swipeable version for mobile devices, and I'll provide a way for people who like the static-row-of-photos view to toggle to it.

All this, AND I updated to mysqli. This has been A Good Week in Coding.


HTML Comment Box is loading comments...