Add project files.
This commit is contained in:
29
SysApp/wwwroot/js/libs/js-AGrid.js
Normal file
29
SysApp/wwwroot/js/libs/js-AGrid.js
Normal file
@ -0,0 +1,29 @@
|
||||
export default class AGrid extends window.AObject {
|
||||
constructor(options = { "element": null, "grid": "row", "columns": 3, "gutter": "5", "easing":"bounce"}) {
|
||||
this.ele = document.querySelector(options.element);
|
||||
this.wWidth = window.innerWidth || document.body.clientWidth;
|
||||
this.options = options;
|
||||
this.updateWidth();
|
||||
}
|
||||
checkColumn() {
|
||||
this.hItem = 0;
|
||||
if (Array.isArray(this.options.columns)) {
|
||||
for (var i = 0; i < this.options.columns.length; i++) {
|
||||
if (this.wWidth < this.options.columns[i][0]) {
|
||||
this.col = this.options.columns[i][1];
|
||||
if (this.options.columns[i].length > 2) {
|
||||
this.hItem = this.options.columns[i][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.col = this.options.columns;
|
||||
}
|
||||
|
||||
}
|
||||
updateWidth() {
|
||||
this.cWidth = this.ele.clientWidth;
|
||||
this.checkColumn();
|
||||
this.wCol = (this.cWidth - (this.options.gutter * (this.col - 1))) / this.col;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user