Bluehost: Web hosting from $3.95/month. Sign Up

jQuery has the answer

Posted on by Clive Walker in JavaScript

Recently, we wanted to add a show/hide paragraph effect for older pub reviews on the Horsham Pub Guide. A show/hide effect means that the older reviews are intially hidden when the page loads but they can be revealed by clicking a simple link.

JavaScript libraries have become popular lately so this seemed to be an ideal opportunity to ‘get our hands dirty’ – so to speak. With our code editor ready, we looked around for a quick solution and found jQuery. It seemed to be what we needed.

jQuery is a new type of JavaScript library. It is not a huge, bloated, framework promising the best in AJAX – nor is just a set of needlessly complex enhancements – jQuery is designed to change the way that you write JavaScript.

Sounds great. What seemed most attractive was jQuery’s small size (~10 kb) and its simplicity.

After an hour or so reading the jQuery website and mailing lists, looking at the tutorial and demos (Cody Lindley’s examples were particularly good), we were able to achieve the effect we wanted.

View: See it in action here. Scroll down to the bottom of the page and click the Older Reviews show/hide link.

In our opinion, the show/hide effect is a great way of maintaining ‘old’ content on a webpage without detracting from the newer content. It enables you to present a much shorter page to the viewer – unless they choose otherwise.

As a a result of our first ‘foray’ into the world of jQuery, we’ll be looking for other uses. For example, we can think of several potential uses for Thickbox....

Leave a comment

A simple question that helps prevent automated form fillers.

© 2016 Clive Walker