1.1.17 • Published 6 years ago

dtcmedia-summarize v1.1.17

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Summarize

Summarize content with the ability to toggle visibility, the vanilla way.

Install

Install with Yarn:

$ yarn add dtcmedia-summarize

Import module:

import summarize from 'dtcmedia-summarize';

Summarize with defaults:

summarize();

Settings

Summarize with settings:

OptionTypeDefault
debugbooleanfalse
defaultStylesbooleantrue
parentSelectorString'.js-summarize'
contentSelectorString'data-summarize-height, data-summarize-overlap'
toggleSelectorString'data-summarize-more, data-summarize-less'
toggleTextSelectorString'data-summarize-more, data-summarize-less'
summarize({
    debug: false,
    defaultStyles: true,
    parentSelector: '.js-summarize',
    contentSelector: 'div',
    toggleSelector: 'button',
    toggleTextSelector: 'button span'
});

Usage

Setup the correct markup with data attributes:

AttributeTypeDescription
heightNumberMaximum height for the summary.
overlapNumberMinimum overlap before the content gets summarized.
moreStringButton text for when content is hidden.
lessStringButton text for when content is visible.

Use the following code example to get you started:

<article class="js-summarize">
    <div data-summarize-height="200" data-summarize-overlap="80">
         <p>Lorem ipsum...</p>
    </div>
    <button data-summarize-more="Show more" data-summarize-less="Show less">
         <span>Show more</span>
         <i class="fa fa-angle-down"></i>
    </button>
</article>
1.1.17

6 years ago

1.1.16

6 years ago

1.1.15

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.0

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago