Skip to main content

JS add-on to show/hide parts of a page.

Project description


collective.js.showmore provides a JQuery plugin.

The plugin hides a set of nodes and replaces them with a “Show more…” link. When the link is clicked, the hidden nodes are made visible again.


The plugin defines a new showMore function. It requires a dictionary as parameter.

The dictionary parameter has one required value:

The expression is a jQuery selector used to select which children nodes will be hidden. In case no nodes are hidden, the link is not created.

The dictionary parameter can optionally define other values:

Defines how many items should not be hidden; default value is 1. In the default case, if there is only one item that would be hidden, do not hide and replace it with the link.
Defines the text of the more link; default value is “Show more…”.
Defines the class added to the more link; default value is showMoreLink.
Defines the class set on the hidden nodes; default value is showMoreHidden.
Enable or disable the display of the less link; default value is true.
Defines the text of the less link; default value is “Show fewer…”.
Defines the class added to the less link; default value is showLessLink.
Defines the class set on the visible nodes; default value is showMoreVisible.


The function can be called like the following:

jq(function() {

li children nodes of all ul’s of the document will be hidden (except the two first li`s of each `ul). A “Show more…” link will be added at the end of each ul. ul’s with two or less li’s will remain untouched. A “Show less…” link will be displayed when you click in the “Show more…” link, so that you can alternate the hidden/visible content.


The Javacript code is registered as a Z3 resource:



1.0a4 - 2011-10-21

  • Correct text to “Show fewer…”. (The css class is still showLessLink.) [elro]

1.0a3 - 2010-01-18

  • Added support for the “Show less…” feature, where a new link is displayed to hide the content when you click in the “Show more…” link. [deo]

1.0a2 - 2009-04-20

  • Added grace_count option to avoid replacing small numbers of items (i.e. one) with a “Show more…” link, effectively not saving any space. [gotcha]

1.0a1 - 2009-04-08

  • Initial release [gotcha]

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for collective.js.showmore, version 1.0a4
Filename, size File type Python version Upload date Hashes
Filename, size (56.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page