Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/attitude/element-auto-width
jQuery plugin that automatically expands element horizontally and fits its content according to set height of the element.
https://github.com/attitude/element-auto-width
Last synced: about 6 hours ago
JSON representation
jQuery plugin that automatically expands element horizontally and fits its content according to set height of the element.
- Host: GitHub
- URL: https://github.com/attitude/element-auto-width
- Owner: attitude
- Created: 2012-11-01T22:19:54.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-07T13:24:35.000Z (about 12 years ago)
- Last Synced: 2023-03-11T07:18:24.131Z (over 1 year ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Element Auto Width
==================This is a jQuery plugin that automatically expands element horizontally and fits its content according
to set height of the element. Minified version is less than 1kB.Usage
-----### 1# Method using data API
You can use only the markup API without writing a single line of JavaScript. Just add
`data-element-auto-width` data attribute to each element you need to auto expand like this:``` html
Some really really really really really really really really really really really really really
really really really really really really really really really really really really really
really really long content comes here...
```And in your CSS file set element height:
``` css
#auto-width-expanding-element {
height: 30px;
}
```### 2# Method using javaScript
Apply plugin to any jQuery object. Remember to redraw element on events like rotationchange, resize etc.
Seet the plugin file.``` js
$(document).ready(function() {
$('#auto-width-expanding-element').elementAutoWidth();
});
```Enjoy!
You can find me on twitter as [@martin_adamko](http://twitter.com/martin_adamko).