-
Notifications
You must be signed in to change notification settings - Fork 119
Plugins
Fatih Kadir Akın edited this page Apr 26, 2016
·
2 revisions
Bricklayer is a simple class that you can extend easily.
This is a simple plugin base:
Bricklayer.prototype.yourAwesomePlugin = function () {
console.log(this);
}
Now you can use it as:
bricklayer.yourAwesomePlugin()
You can reach out container element (first parameter of constructor) using this.element
new Bricklayer(document.querySelector('bricklayer'))
Element will be the container:
Bricklayer.prototype.yourAwesomePlugin = function () {
console.log( this.element ) // this.element is `document.querySelector('bricklayer')`
}
People can pass options to the Bricklayer, and your plugin can reach out them.
new Bricklayer(document.querySelector('bricklayer'), {awesomeOption: true})
Element will be the container:
Bricklayer.prototype.yourAwesomePlugin = function () {
console.log( this.options.awesomeOption ) // true
}
Beside public methods, you can also use some helper methods which can help you when you develop plugins:
Method/Property Name | Description | Return Type | Type |
---|---|---|---|
getColumnCount() |
Returns number of columns | number |
Method |
checkColumnCount() |
Recalculates column count | void |
Method |
findMinHeightColumn() |
Finds the minimum heighted column | HTMLElement |
Method |
getColumns() |
Returns all column elements | [HTMLElement] |
Method |
reorderElements(columnCount : number) |
Reorders elements by given columnCount parameter |
void |
Method |
getElementsInOrder() |
Returns all elements in order | [HTMLElement] |
Method |
ruler |
.bricklayer-column-sizer Element |
HTMLElement |
Property |
columnCount |
Calculated column count | number |
Property |
elements |
All elements in container | [HTMLElement] |
Property |
If you have any questions, please chat us on Gitter!
Copyright © Bricklayer.js - Adem İlter, Fatih Kadir Akın
- Quick Start
- Installation
- Examples
- Methods
- Events
- Responsiveness
- Plugins
- Frameworks
- License