Code Monkey home page Code Monkey logo

ember-read-more's Introduction

Ember-read-more

Build Status Code Climate npm version

A simple read-more component for ember, using maximum height.

Installation

ember install ember-read-more

Usage

{{#read-more}}
  Lorem ipsum...
{{/readmore}}

Options

  • isOpen - The on-load state of the component (default: false)
  • maxHeight - The maximum visible height when the component is closed (default: '200px')
  • toggleClass - The class of the toggle link (default: 'read-more-toggle')
  • openText - The open action text of the toggle link (default: 'Read more')
  • closeText - The close action text of the toggle link (default: 'Close')
  • bodyClass - The class of the content div (default: 'read-more-body')
  • bodyCss - The default styles of the content div (default: 'overflow-y: hidden; width: 100%; display: block;')

Actions

The onClose or the onOpen action is triggered when the toggle link is clicked.

You can set these actions like the example below:

{{#read-more onClose='yourCloseAction' onOpen='yourOpenAction'}}
  Lorem ipsum...
{{/readmore}}

Class bindings

The is-open or the is-closed class is automatically added to the component. Use these classes if you want to style your component differently for each state.

Animations

This component is using css max-height to toggle your content. Adding the following in your project styles should do the trick:

.read-more-body {
  max-height: 1000px; // set a height that your content will not exceed
  transition: max-height .3s;  // change the .3s to the duration you want
}

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

ember-read-more's People

Contributors

ember-tomster avatar sprocketc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.