Giter VIP home page Giter VIP logo

succinct's Introduction

Succinct

*A tiny jQuery plugin for truncating multiple lines of text

##How does it work? Succinct shortens your text to a specified size, and then adds an ellipsis to the end.

##Demo Live Demo: http://micjamking.github.io/succinct/

##Usage Specify the elements that you would like to truncate as a selector, and then set the size parameter to the amount you would like to see. For example, if you would like to truncate all elements with a specific class, ie. <p class="truncate"> to 120 characters...

<script>
    $(function(){
        $('.truncate').succinct({
            size: 120
        });
    });
</script>

By default, the plugin truncates text to 240 characters.

To change the ellipsis to an HTML unicode arrow "โ†’"...

<script>
    $(function(){
        $('.truncate').succinct({
            omission: '&rarr;'
        });
    });
</script>

By default, the plugin also removes the set of 32 ASCII special characters at the end of words, ie. ! " # $ and so on. To disable this behavior...

<script>
    $(function(){
        $('.truncate').succinct({
            ignore: false
        });
    });
</script>

##Details

    • Succinct is < 0.6kb minified
  • You'll need a copy of jQuery to run this plugin
  • If you have any suggestions, comments, or creative insults for my code, add an issue or fork the repo.

###Copyright MIT license Copyright (c) 2013 Mike King (@micjamking)

succinct's People

Contributors

micjamking avatar simplesessions avatar simeydotme 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.