Skip to content

Commit

Permalink
feat(md-tabs): add support for swipeable tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Jan 29, 2017
1 parent fc4d201 commit 5aac16e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { inject } from 'aurelia-dependency-injection';
import { TaskQueue } from 'aurelia-task-queue';
import { fireMaterializeEvent } from '../common/events';
import { AttributeManager } from '../common/attributeManager';
import {getBooleanFromAttributeValue} from '../common/attributes';

@customAttribute('md-tabs')
@inject(Element, TaskQueue)
export class MdTabs {
@bindable() fixed = false;
@bindable() onShow = null;
@bindable() responsiveThreshold = Infinity;
@bindable() swipeable = false;
@bindable() transparent = false;

constructor(element, taskQueue) {
Expand All @@ -19,6 +22,10 @@ export class MdTabs {
this.tabAttributeManagers = [];
}

bind() {
this.swipeable = getBooleanFromAttributeValue(this.swipeable);
}

attached() {
this.attributeManager.addClasses('tabs');

Expand All @@ -35,7 +42,9 @@ export class MdTabs {
if (self.onShow) {
self.onShow({ element: jQueryElement});
}
}
},
swipeable: this.swipeable,
responsiveThreshold: this.responsiveThreshold
});
let childAnchors = this.element.querySelectorAll('li a');
[].forEach.call(childAnchors, a => {
Expand Down

0 comments on commit 5aac16e

Please sign in to comment.