Coder Social home page Coder Social logo

ellipsis's Introduction

ellipsis

simple jquery plugin that excerpts text depending on lines or characters number.

Build Status Coverage Status DevDependency Status


installation.

  1. Download using one of the following Methods

    • direct download or clone from this repository.
    • via npm
      $ npm install --save jquery-ellipsis
    • via bower
      $ bower install --save ellipsis
  2. please be sure to includejquery >= 2.x then include ellipsis:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    <script src="path/to/jquery.ellipsis.min.js"></script>

Usage

ellipsis can be used in two different ways:

  1. via data attributes.

      <p data-toggle="ellipsis" data-type="chars" data-count="150"> Amet id nisi ipsa pariatur eaque aperiam dolorum eius quia, vero provident? Doloremque impedit at cupiditate illum magnam, quo, vel corrupti. Esse voluptates hic vitae porro temporibus temporibus! Possimus rem.</p>
  2. manual way:

    <p id="ellipsis_me">Amet id nisi ipsa pariatur eaque aperiam dolorum eius quia, vero provident? Doloremque impedit at cupiditate illum magnam, quo, vel corrupti. Esse voluptates hic vitae porro temporibus temporibus! Possimus rem.</p>
    
    <script>
    $(document).ready(function() {
      $('#ellipsis_me').ellipsis(options);
    });
    </script>

options

option type value
type String determines type is whetherchars or lines number that the text should be excerpted.
count Number determines the number of chars or lines should the text be excerpted.

events

event when
initialize.ellipsis before the initialization of the plugin
initialized.ellipsis after the initialization.
excerpt.ellipsis before excerpt the text
excerpted.ellipsis after the text being excerpted
update.ellipsis before updating when window is resized
updated.ellipsis after updating.

example:

$('#paragraph').on('initialize.ellipsis', function() {
  // do some stuff
});

Features:

  • enhance the puplic API
    • two different types of excerpts by lines/characters

    • Support re-adjust option later.

    • different custom event through the life cycle of the plugin.

    • Destroyable.

    • data attribute automatic init.

    • Up comming!

      • use dedicated word instead of ...
      • use url to show more.
      • use link class to control the style of link.

ellipsis's People

Contributors

pencilpix avatar

Watchers

James Cloos 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.