jQuery some more

13th December 2009

Alice's Adventures in Wonderland

by Lewis Carroll

Down the Rabbit-Hole

ALICE was beginning to get very tired of sitting by her sister on the bank and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, "and what is the use of a book," thought Alice, "without pictures or conversations?'

Through the Looking Glass

by Lewis Carroll

Looking Glass House

One thing was certain, that the white kitten had had nothing to do with it: -- it was the black kitten's fault entirely. For the white kitten had been having its face washed by the old cat for the last quarter of an hour (and bearing it pretty well, considering); so you see that it couldn't have had any hand in the mischief.

Next Demonstration

Previous Demonstration

Information

Yet another 'show me some more / less' routine, but this time using jQuery to add a little animation and to simplify the script.

Just click the 'more ....' to expose the extra information and the '.... less' to close it.

The jQuery is just a couple of lines long and all that is needed is to enclose the hidden information in a div with a class="hidden", then immediately after this div have an element with a classname 'show'. This demo uses an empty <i> element into which the jQuery routine adds 'more ....' and is changed to '.... less' when displaying the extra imformation. I have used jQuery to hide the extra information and to display the 'more / less' clickable areas so that if javascript is turned off then the full text will be shown without the 'more... / .... less' text.

Tested in IE6, IE7, IE8, Firefox, Opera, Safari(PC) and Google Chrome.

Download

All the information you need for this can be found in the source code and you will also need a copy of jQuery.