Skip to content

Commit

Permalink
feat(md-carousel): new "special" carousell from Materialize 0.97.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Aug 3, 2016
1 parent 169e705 commit 0bd99cd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/carousel/carousel-item.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<template>
<a class="carousel-item" href.bind="mdHref"><img src.bind="mdImage" /></a>
<template class="carousel-item">
<a if.bind="mdHref" href.bind="mdHref">
<img if.bind="mdImage" src.bind="mdImage" />
</a>
<slot></slot>
</template>
3 changes: 3 additions & 0 deletions src/carousel/carousel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
md-carousel {
display: block;
}
3 changes: 2 additions & 1 deletion src/carousel/carousel.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<template class="carousel" style="display: block;">
<template class="carousel">
<require from="./carousel.css"></require>
<slot></slot>
</template>
17 changes: 12 additions & 5 deletions src/carousel/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getBooleanFromAttributeValue } from '../common/attributes';
@customElement('md-carousel')
@inject(Element)
export class MdCarousel {
@bindable() mdIndicators = true;
@bindable({
defaultBindingMode: bindingMode.oneTime
}) mdSlider = false;
Expand All @@ -19,11 +20,17 @@ export class MdCarousel {
this.element.classList.add('carousel-slider');
}

let options = {
full_width: getBooleanFromAttributeValue(this.mdSlider),
indicators: this.mdIndicators
};

// workaround for: https://github.com/Dogfalo/materialize/issues/2741
if (getBooleanFromAttributeValue(this.mdSlider)) {
$(this.element).carousel({full_width: true});
} else {
$(this.element).carousel();
}
// if (getBooleanFromAttributeValue(this.mdSlider)) {
// $(this.element).carousel({full_width: true});
// } else {
// $(this.element).carousel();
// }
$(this.element).carousel(options);
}
}

0 comments on commit 0bd99cd

Please sign in to comment.