Giter VIP home page Giter VIP logo

jquery.fn.autoresize's Introduction

jQuery.fn.autoResize

This is a much-needed update of the slightly buggy 2009 version

A plugin for jQuery which changes the dimensions of input elements to suit the amount of data entered. It operates on textarea, input[type=text] and input[type=password] elements.

Usage is as follows:

$('textarea#foo').autoResize();

You can pass options:

$('textarea#foo').autoResize({
	maxHeight: 200,
	minHeight: 100
});

Available options include:

  • minWidth: (default: "original") A number or the string "original" to signify the current width as the minimum (note: This option is only useful on <input> elements, i.e. elements that resize width-ways)
  • maxWidth: (default: 500) A number or the string "original" to signify the current width as the maximum (note: This option is only useful on <input> elements, i.e. elements that resize width-ways)
  • minHeight: (default: "original") A number or the string "original" to signify the current height as the minimum (note: This option is only useful on <textarea> elements, i.e. elements that resize height-ways)
  • maxHeight: (default: 500) A number or the string "original" to signify the current height as the maxiumum (note: This option is only useful on <textarea> elements, i.e. elements that resize height-ways)
  • onResize: A callback function fired whenever a resize occurs.
  • animate: (default: {duration: 200}) Set to either false or an animation configuration object, i.e. the one passed as the second argument to jQuery.fn.animate. This signifies whether or not the element should animate when it resizes (set to false if you don't want animation).

You can unbind listeners bound to by this plugin like so:

$(foo).unbind('.autoResize');

... or destroy everything, including stub clone objects used for the effect:

$(foo).data('AutoResizer').destroy();

Please report bugs in Github (the issues tab).

Tested on the following browsers:

  • Opera 11.5
  • Firefox 4/6
  • Safari 5.0
  • IE9 (IE6-8 too, but see below)
  • Chrome 15

Note: It will work in IE6-8 also, but only if your TEXTAREA has display:block; (display:inline;, the default, doesn't appear to work very well)

jquery.fn.autoresize's People

Contributors

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