Giter Club home page Giter Club logo

autogrow's Introduction

autogrow.js

endorse

autogrow.js is a jQuery plugin that, like most plug-ins, was built out of frustration for lack of support for a much-needed feature, namely the ability for a textarea to automatically grow and shrink dynamically with its content. I received a head-start from this post, but decided I needed more functionality. It handles the paste event and 'ctrl+x', or cutting.

Basic usage (Interactive Demo):

$('textarea').autogrow(); //or some selector that will grab textareas

autogrow.js has some options that you can set:

  • context: defaults to $(document). The parent element events will be delegated to. If you want to simply use defaults but want to pass in a context, you can just do that like this: $('textarea').autogrow($('.myContext'));
  • animate: defaults to true. Set to false if you don't want the resizing of the box to be animated.
  • speed: defaults to 200. Speed of the resize animation.
  • fixMinHeight: defaults to true. Set to false if you don't want the box to stop shrinking when it hits its initial size.
  • cloneClass: defaults to 'autogrowclone'. Helper CSS class for the clone used for measuring sizes. Use this if you need to apply special rules for a textbox that is right next to the one you're autogrowing, but not exactly it so that they are identical.
  • onInitialize: defaults to false. Will trigger autogrow on init.

Example:

var opts = {
    context: $('li')
    , animate: false
    , cloneClass: 'faketextarea'
};
$('.mytextareas').autogrow(opts);

autogrow's People

Contributors

crisfole avatar deefour avatar johnbhall avatar ultimatedelman avatar

Watchers

 avatar  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.