FlexDrawer Documentation
Markup
Any <div> element with the flexdrawer class will automatically be transformed into a FlexDrawer UI.
Use data-attributes to configure the FlexDrawer and overwrite default values.
Open the Data-attributes tab to see each data-attribute explained in detail.
Below is the markup for a drawer, only the class is mandatory.
<div class="flexdrawer"
id="someUniqueId"
data-target="btnTest"
data-trigger="click"
data-position="right"
data-width="80vw"
data-height="100%"
data-background-color="#f6f6f6"
data-offset-top="0"
data-sliding-time="0.3s"
data-container="body"
data-close="outside"
data-on-close="someFunctionName"
>Some Content</div>
Default configuration
Most properties can be configured using a configuration object, these properties will be the default values for the individual drawers. Some of these properties can be overwritten by the individual drawers
Here is how to set all the configurable properties, these will be identical for all drawers, however most can be overwritten by the individual drawers (only the scrim cannot).
FlexDrawer.configure({
trigger: "click",
position: "right",
backgroundColor: "#f6f6f6",
zIndex: 1000,
padding: "10px",
offsetTop: "0",
slidingTime: "0.3s",
width: "80vw",
height: "100%",
container: "body",
scrim: {
opacity: 0.3,
backgroundColor: "#aaa"
}
});
Data-attributes
| Attribute | Values | Description |
|---|---|---|
| class | flexdrawer |
|
| data-target | html id |
|
| data-trigger | click | hover |
|
| id | html id |
|
| data-position | top | right | bottom | left |
|
| data-width | length specifying the drawer width |
|
| data-height | length specifying the drawer height |
|
| data-padding | css padding |
|
| data-offset-top | length specifying the offset from the top |
|
| data-sliding-time | drawer slide out animation time in seconds |
|
| data-background-color | html color | none |
|
| data-box-shadow | none | auto |
|
| data-container | body | parent |
|
| data-close-modes | outside,target,button |
|
| data-on-close | function name |
|
| data-z-index | number |
|
Events
API
| Action | Code | Description |
|---|---|---|
| open |
|
Open a drawer programmatically using the static .open() function passing the id of the drawer. The static .open() function returns the drawer object in case you need it. |
| close |
|
Close a drawer programmatically. There are 2 different ways :
|