Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/interactive-pioneers/iptools-jquery-offcanvas

Simple CSS3 animated offcanvas.
https://github.com/interactive-pioneers/iptools-jquery-offcanvas

animation iptools-jquery-offcanvas jquery offcanvas

Last synced: 13 days ago
JSON representation

Simple CSS3 animated offcanvas.

Awesome Lists containing this project

README

        

# iptools-jquery-offcanvas [![Build Status](https://api.travis-ci.org/interactive-pioneers/iptools-jquery-offcanvas.svg)](https://travis-ci.org/interactive-pioneers/iptools-jquery-offcanvas) [![npm version](https://badge.fury.io/js/iptools-jquery-offcanvas.svg)](https://badge.fury.io/js/iptools-jquery-offcanvas) [![Bower version](https://badge.fury.io/bo/iptools-jquery-offcanvas.svg)](http://badge.fury.io/bo/iptools-jquery-offcanvas)

Simple CSS3 animated offcanvas.

## Related

- [native js version](https://github.com/interactive-pioneers/iptools-offcanvas)

## legacy

- 0.0.2 [documentation](https://github.com/interactive-pioneers/iptools-jquery-offcanvas/blob/master/doc/0.0.2/README.md)

## Features

- Displays content inside an offcanvas from the top, right, bottom or left.
- Multiple instances at once.
- Static, instance is open on page load.
- CSS3 transitions and animations.

## Options

All options are optional.

Name | type | default value | values | description
:----------------------|:-----------|:------------------------------|:-------------------------------------------|:-----------------------------------
`baseClass` | `string` | `offcanvas` | valid css class string | base css class
`type` | `string` | `left` | `top`, `right`, `bottom`, `left` | canvas position
`single` | `boolean` | `true` | | single mode, closes all other canvases
`closeOnClickOutside` | `boolean` | `false` | | close canvas on click outside
`static` | `boolean` | `false` | | open after initialization
`staticCloseCondition` | `function` | `function() { return true; }` | a function returning either true or false | close condition for static canvas

## Methods

Method | Parameter | Return | Description
:-------------|:----------|:----------|:-----------
`getSettings` | | `object` | retrieve settings
`isActive` | | `boolean` | returns if canvas is active (open)
`toggle` | `boolean` | | not required. open (true), close (false) or toggle (leave empty)
`destroy` | | | destroy offcanvas

## Events

Event pattern: `{eventName}.{elementId}@iptOffCanvas`

Event | Element | Description
:---------------------------------|:---------------|:-----------
`initialized.custom@iptOffCanvas` | this.$element | Emitted when canvas is ready to use.
`opened.custom@iptOffCanvas` | this.$element | Emitted when the canvas opens.
`closed.custom@iptOffCanvas` | this.$element | Emitted when the canvas closes.

## Requirements

- jQuery >=1.11.3 <4

## Example

```html
open
close
toggle

content


X

$(document).ready(function() {

// bind
$('#custom').iptOffCanvas({
baseClass: 'offcanvas',
closeOnClickOutside: false,
single: true,
static: false,
staticCloseCondition: function() { return true; },
type: 'right'
});

// retrieve settings
var settings = $('#custom').data(pluginName).getSettings();

// check if active (open)
var isActive = $('#custom').data(pluginName).isActive();

// open, close or toggle
$('#custom').data(pluginName).toggle(true); // true for open, false to close, leave empty to toggle

// destroy canvas
$('#custom').data(pluginName).destroy();

// example event listener
$('#custom').on('opened.custom@iptOffCanvas', function() {
console.log('canvas opened');
});

});

```

## Licence

Copyright © 2015-2017 Interactive Pioneers GmbH. Licenced under [GPL-3](LICENSE).