Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ryanve/taos

Toggle areas or styles via HTML5 data attributes
https://github.com/ryanve/taos

Last synced: about 1 month ago
JSON representation

Toggle areas or styles via HTML5 data attributes

Awesome Lists containing this project

README

        

**[TAOS](https://github.com/ryanve/taos)** (toggle areas or styles) is a [jQuery](http://jquery.com) (or [ender](http://ender.no.de/#jeesh)) plugin that helps designers easily setup efficient toggles and style switchers via HTML5 data attributes. I wrote the plugin because I wanted insanely simple but flexible ways to make style switchers and element toggles without rewriting JavaScript each time.

```html

```

## Styles

A **style** toggle is activated by adding the `data-taos-style` attribute to the element that should be its control. The format for attribute is `selector ! class(es)` where the selector represents the element(s) whose class you want to toggle. If the selector is omitted, the toggle will affect the element on which it is placed. If you just put one class, then it will simply toggle on and off. Delimit with spaces to toggle multiple classes at once. Delimit with pipes `|` to cycle between classes. Examples:

#### 1-way (on/off)
```html

Toggle styles

Toggle styles

Toggle styles

Toggle styles

Toggle styles
````

#### Multiple (cycle classes)
```html

Toggle styles

Toggle styles

Toggle styles
````

## Areas

An **area** toggle is activated by adding the `data-taos-area` attribute to the element that should be its control. The value of the attribute should be the selector for the element you want to toggle. Multiple elements can be cycled by separating selectors with pipes `|`. Flags for duration (in milliseconds) and easing method can be added. In basic jQuery the two easing methods are `swing` (default) and `linear`. If using jQuery UI's effects package then [these easing methods](http://jqueryui.com/demos/effect/easing.html) are also available.

#### 1-way (show/hide)

```html

Toggle content

Toggle content

Toggle content

Toggle content

Toggle details
```

#### Multiple (cycle shown elems)

Use the pipe `|` to delimit areas:

```html

Next photo

Show info

Show info
```

## License

### TAOS is available under the [MIT license](http://en.wikipedia.org/wiki/MIT_License)

Copyright (C) 2011 by [Ryan Van Etten](https://github.com/ryanve)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.