Skip to main content

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

Project description

Introduction

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.

API

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

The dictionary parameter has one required value:

expression

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 three other values:

link_text

Defines the text of the link; default value is “Show more…”.

link_class

Defines the class added on the link; default value is showMoreLink.

hidden_class

Defines the class set on the hidden nodes; default value is showMoreHidden.

Example

The function can be called like the following:

jq(function() {
    jq('ul').showMore({expression:'li:gt(1)'});
});

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.

Miscellaneous

The Javacript code is registered as a Z3 resource:

++resource++collective.showmore.js

Changelog

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.

Source Distribution

collective.js.showmore-1.0a1.zip (54.8 kB view details)

Uploaded Source

File details

Details for the file collective.js.showmore-1.0a1.zip.

File metadata

File hashes

Hashes for collective.js.showmore-1.0a1.zip
Algorithm Hash digest
SHA256 3d3e80a566226ff11d1bdabb97f9c0c77f13e99657bb77e312da302121ce944e
MD5 b3c55e00e04dce2131036ad06503c5d3
BLAKE2b-256 474756d00410382c1ea6fb40f5b3ec19a9cfcd514be16c677d1f0643fbd420f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page