aboutsummaryrefslogtreecommitdiffstats
path: root/library/readmore.js/README.md
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-07-22 14:03:14 +0200
committerMario Vavti <mario@mariovavti.com>2016-07-22 14:03:14 +0200
commit38e46fff548729ba459d0a83a46fbfa0d844e85d (patch)
tree488782af68f0e6709a037e697d7e373656143f6c /library/readmore.js/README.md
parent7d897a3f03bd57ed556433eb84a41963ba44e02e (diff)
downloadvolse-hubzilla-38e46fff548729ba459d0a83a46fbfa0d844e85d.tar.gz
volse-hubzilla-38e46fff548729ba459d0a83a46fbfa0d844e85d.tar.bz2
volse-hubzilla-38e46fff548729ba459d0a83a46fbfa0d844e85d.zip
upgrade readmore.js and improve collapsing a little
Diffstat (limited to 'library/readmore.js/README.md')
-rw-r--r--library/readmore.js/README.md22
1 files changed, 17 insertions, 5 deletions
diff --git a/library/readmore.js/README.md b/library/readmore.js/README.md
index 0116fbe8b..24649f32d 100644
--- a/library/readmore.js/README.md
+++ b/library/readmore.js/README.md
@@ -9,16 +9,22 @@ Readmore.js is tested with—and supported on—all versions of jQuery greater t
## Install
-Install Readmore.js with Bower:
+Install Readmore.js with npm:
```
-$ bower install readmore
+$ npm install readmore-js
```
Then include it in your HTML:
```html
-<script src="/bower_components/readmore/readmore.min.js"></script>
+<script src="/node_modules/readmore-js/readmore.min.js"></script>
+```
+
+Or, using Webpack or Browserify:
+
+```javascript
+require('readmore-js');
```
@@ -49,17 +55,23 @@ $('article').readmore({
* `startOpen: false` do not immediately truncate, start in the fully opened position
* `beforeToggle: function() {}` called after a more or less link is clicked, but *before* the block is collapsed or expanded
* `afterToggle: function() {}` called *after* the block is collapsed or expanded
+* `blockProcessed: function() {}` called once per block during initilization after Readmore.js has processed the block.
If the element has a `max-height` CSS property, Readmore.js will use that value rather than the value of the `collapsedHeight` option.
### The callbacks:
-The callback functions, `beforeToggle` and `afterToggle`, both receive the same arguments: `trigger`, `element`, and `expanded`.
+The `beforeToggle` and `afterToggle` callbacks both receive the same arguments: `trigger`, `element`, and `expanded`.
* `trigger`: the "Read more" or "Close" element that was clicked
* `element`: the block that is being collapsed or expanded
* `expanded`: Boolean; `true` means the block is expanded
+The `blockProcessed` callback receives `element` and `collapsable`.
+
+* `element`: the block that has just been processed
+* `collapsable`: Boolean; `false` means the block was shorter than the specified minimum `collapsedHeight`--the block will not have a "Read more" link
+
#### Callback example:
Here's an example of how you could use the `afterToggle` callback to scroll back to the top of a block when the "Close" link is clicked.
@@ -166,6 +178,6 @@ $ npm install
Which will install the necessary development dependencies. Then, to build the minified script:
```
-$ gulp compress
+$ npm run build
```