Readmorejs::Rails (HOW TO?)

1–2 minutes

read

 

Readmorejs::Rails

Installation

Add this line to your application’s Gemfile:

gem 'readmorejs-rails'

And then execute:

$ bundle install

Or install it yourself through terminal:

$ gem install readmorejs-rails

How to use?

In your application.js, include the js file:

 //= require readmore

Now directly use in your any html.erb file ,


like this and now write a script.

var lineHeight = 20;

var lineHeight = 20;

var numLines = 3;
$('.readmore').readmore({   

speed: 1000,  

collapsedHeight: lineHeight * numLines,  

heightMargin: lineHeight * 1
});

 

Leave a comment