https://github.com/grassator/jquery-brute-tabs
Minimal but easily extendible jquery tabs plugin for everyone.
https://github.com/grassator/jquery-brute-tabs
Last synced: 10 months ago
JSON representation
Minimal but easily extendible jquery tabs plugin for everyone.
- Host: GitHub
- URL: https://github.com/grassator/jquery-brute-tabs
- Owner: grassator
- License: mit
- Created: 2013-05-25T07:01:00.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-05-25T07:02:34.000Z (over 12 years ago)
- Last Synced: 2023-04-09T14:49:36.176Z (almost 3 years ago)
- Language: JavaScript
- Size: 203 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# Brute Tabs
Minimal but easily extendible jquery tabs plugin for everyone.
What makes **Brute Tabs** really different is an ability to customize every aspect of it's looks and behavior by providing configuration functions instead of limited scalar options used in most jQuery plugins.
## Getting Started
Download the latest version from [github][github]. Then in your web page:
[github]:https://github.com/grassator/jquery-brute-tabs/archive/master.zip
```html
$(function() {
$('#demo').bruteTabs();
});
Content for first tab
Content for second tab
Content for third tab
```
## Configuration
You can pass configuration object to plugin initialization with parameters described below:
### `baseName` string
Base for all string entities related to Brute Tabs including base part of element classes when using default `generateClassName` function.
Defaults to `brute-tabs`
### `generateClassName` function (elementNameOrModifier, isModifier)
Generates appropriate class names for select elements in generated markup. It can be used to adjust class names to conform to specific naming guidelines, like the ones used in [BEM](http://bem.info/).
Default implementation just appends `elementNameOrModifier` to `baseName` with `-` in the middle and can be accessed via `$.fn.bruteTabs.generateClassName`.
Here is an sample implementation of BEM-style class generation:
```js
$('select').bruteTabs({
generateClassName: function (elementNameOrModifier, isModifier) {
var cls = this.baseName;
if(elementNameOrModifier) {
cls += (isModifier ? '_' : '__') + elementNameOrModifier;
}
return cls;
}
});
```
### Function Context
All of the configuration functions are merged into special object that contains state of tabs widget and handles user and API interactions. Apart from ability to access all the other configuration options within configuration function it also provides references to several useful properties like `$el`, `$currentTab` and `$currentPane`.
### Global Configuration
All of the previously listed options are also available in `$.fn.bruteTabs.options` object that contains default options for the plugin allowing you to adjust them globally.
## Further Extending
If you need even more control or wish to extend functionality of this plugin, you can extend base class that handles state and user interactions. It is accessible via `$.fn.bruteTabs.klass`.
## Licensing
Licensed under permissive [MIT-style license](https://github.com/grassator/jquery-brute-tabs/blob/master/LICENSE-MIT).