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....
ThemeForest sell a range of site templates from some fantastic designers. They also sell some great WordPress themes!
Online invoicing made easy with CurdBee!
» Sign up
Join SugarSync for online backup. Sync your files between Mac, PC and mobile phone. Get 5 GB FREE and up to 10 GB bonus space!
HTML5 and CSS3 for the Real World will show you how to create websites using these new methods.
This easy-to-follow guide covers everything you need to know to get started. You’ll master the new semantic markup available in HTML5, as well as how to use CSS3 without sacrificing clean markup or resorting to complex workarounds. Buy the Book! · FREE Chapters