Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

reececomo/readmore-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

48 Commits

Repository files navigation

readmore-js

Simple "Read More" jQuery plugin for HTML5 projects

Simply add the "read-more" class to your HTML object, and a "prompt" sub-element to expand the content:

jQuery

// Global with defaults
$.readMore();
// Selector with defaults
$(".myObjects").readMore();

HTML

<div class="read-more">
 <!-- Content Here -->
 <p>My example content</p>
 <p>Lorem ipsum...</p>
 <p class="prompt">
 <a class="button" href="#">Read More</a>
 </p>
</div>

Sample Demo

Here is an example using Bootstrap classes: View Demo

Options

  • selector*: The jQuery selector whose content to shrink
  • expandTrigger: The jQuery selector that expands the shrunken content
  • previewHeight: The max height (in px/pt) to display when shrunk
  • fadeColor1: Transparent background color (fully transparent)
  • fadeColor2: Opaque background color (fade to this color)
// Global defaults
$.readMore({
 selector: ".read-more",
 expandTrigger: ".prompt",
 previewHeight: 120,
 fadeColor1: "rgba(255,255,255,0)",
 fadeColor2: "rgba(255,255,255,1)"
});
// Selector defaults
$(".read-more").readMore({
 expandTrigger: ".prompt",
 previewHeight: 120,
 fadeColor1: "rgba(255,255,255,0)",
 fadeColor2: "rgba(255,255,255,1)"
});

AltStyle によって変換されたページ (->オリジナル) /