GitXplorerGitXplorer
a

jquery-expander

public
3 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
cf02e698a4a2d0b6b13d673b1da5beb073ebefff

fixed filtering bug

committed 13 years ago
Unverified
f123dbb00abc03598b5fe4ff541ebd1af364ba81

added in grunt plugins for jasmine and csslint cssmin for fun

committed 13 years ago
Unverified
2b8ead6d9cc29adce250782a83f72f1dbbf26e5d

added in grunt plugins for jasmine and csslint cssmin for fun

committed 13 years ago
Unverified
9085b63461a3f317b0761c29a69dfd70439f4633

Updated README

committed 13 years ago
Unverified
1e861ca1b397c9bdbba5f9ddeeba056722238286

merged and removed conflicts

committed 13 years ago
Unverified
449cd12247b48251bdef046a6d6254de0846953b

using grunt for unit tests and minification

committed 13 years ago

README

The README file for this repository.

expander: a jQuery plugin

Expander is a jQuery plugin that makes it easy to support expanding long lists, tables and any group of items with "Show N more" functionality.

Changelog

  • Apr 27, 2012 (0.2.5): Included Grunt for building, unit testing and minification.
  • Apr 23, 2012 (0.2.5): Major plugin overhaul. Supports all DOM tags with at least one child element. Packaged with minified script.
  • Feb 08, 2012 (0.1.0): Initial plugin release.

Usage

First, load jQuery and the plugin:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="jquery.expander.min.js" type="text/javascript"></script>

Second, make sure you have a class in your Stylesheet to handle hidden elements:

.hidden {
  display: none;
  visibility: hidden;
}

Now, let's attach it to your list on DOM ready:

<pre>
   jQuery(document).ready(function() {
     jQuery(".expander").expander();
   });
</pre>

This will add a link to the bottom of your list object:

<table class="expander">
  ...your table info goes here as usual...
</table>
<a href="#" name class="expander-more">Show N More</span>

where N is at most 10.

Settings

filter

If your items are filtered on certain types of rows, such as the following:

<table class="expander">
  <thead>
    ...header info...
  </thead>
  <tbody>
    <tr class="type_1">
      ...stuff about item 1, type 1...
    </tr>
    <tr class="type_1">
      ...stuff about item 2, type 1...
    </tr>
    <tr class="type_2">
      ...stuff about item 3, type 2...
    </tr>
    <tr class="type_2">
      ...stuff about item 4, type 2...
    </tr>
  </tbody>
</table>

and you only want to show more rows of a certain type, you can add in the filter parameter and specify which rows you want to expand. For example, if we wanted to only show more of type1, we would declare the following:

$('.expander').expander({ filter: 'type_1'});

Author

Adam Conrad (@adam_conrad)

Other

MIT License

Copyright (c) 2012, Adam Conrad (acconrad -[at]- gmail [dot] com)