-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #7
- Loading branch information
Showing
11 changed files
with
772 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,26 @@ | ||
This is the documentation of the carousel component! | ||
A carousel component similar to [Bootstrap javascript carousel](http://getbootstrap.com/javascript/#carousel) | ||
|
||
#### Attributes #### | ||
|
||
| Name | Binding | Type | Default | Description | | ||
| ---- | ------- | ---- | ------- | ----------- | | ||
| **index** | 2-way | int | 0 | Index (0-based) of the active slide. | | ||
| **interval** | 1-way | int | 5000 | The amount of time to delay between automatically cycling an item. If false or negative, carousel will not automatically cycle. | | ||
| **pause** | none | string | "hover" | Pauses the cycling of the carousel on mouseover and resumes the cycling of the carousel on mouseout. | | ||
| **wrap** | none | boolean | true | Whether the carousel should cycle continuously or have hard stops. | | ||
| **noTransition** | none | boolean | false | Whether transitions are activated. | | ||
|
||
#### Elements #### | ||
| Name | Description | | | ||
| ---- | ----------- | - | | ||
| **@slide** | A slide of the carousel. | | | ||
| **@slide / @body** | The body of the slide, any HTML element. | **Default** | | ||
| **@slide / @caption** | The caption of the slide, a block of HTML displayed at the bttom center. | Optionnal | | ||
|
||
#### Events #### | ||
|
||
| Name | Description | | ||
| ---- | ----------- | | ||
| **onslidestart** | This event fires immediately when the transition starts. | | ||
| **onslideend** | This event is fired when the carousel has completed its slide transition. | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,43 @@ | ||
var description = require('./README.hsp').description; | ||
var carouselCpt = require('../../carousel/carousel.hsp').carousel; | ||
var carousel = require('../../carousel/carousel.hsp').carousel; | ||
|
||
{export template demo()} | ||
This is a demo of the carousel component! | ||
<#carouselCpt /> | ||
Updated again! | ||
{let slideIndex = 0} | ||
{let slideInterval = 2000} | ||
<#carousel interval="{slideInterval}" index="{slideIndex}"> | ||
<@slide> | ||
<@body> | ||
<img style="width: 800px; height: 400px;" src="http://placekitten.com/800/400"> | ||
</@body> | ||
<@caption> | ||
<h3>First slide label</h3> | ||
<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p> | ||
</@caption> | ||
</@slide> | ||
<@slide> | ||
<@body> | ||
<img style="width: 800px; height: 400px;" src="http://placekitten.com/801/400"> | ||
</@body> | ||
<@caption> | ||
<h3>Second slide label</h3> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> | ||
</@caption> | ||
</@slide> | ||
<@slide> | ||
<img style="width: 800px; height: 400px;" src="http://placekitten.com/800/401"> | ||
</@slide> | ||
</#carousel> | ||
|
||
<form role="form"> | ||
<div class="form-group"> | ||
<label for="indexField">Index (0-based)</label> | ||
<input type="number" class="form-control" id="indexField" value="{slideIndex}"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="intervalField">Interval (negative number to stop the cycle)</label> | ||
<input type="number" class="form-control" id="intervalField" value="{slideInterval}"> | ||
</div> | ||
</form> | ||
|
||
<#description /> | ||
{/template} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,39 @@ | ||
var CarouselController = require("./carousel").CarouselController; | ||
|
||
{export template carousel using ctrl:CarouselController} | ||
<h1 class="carousel">Hello carousel</h1> | ||
<div class="carousel slide" onmouseover="{ctrl.toggleOnHover()}" onmouseout="{ctrl.toggleOnHover()}" onswipe="{ctrl.handleSwipe(event)}"> | ||
{if ctrl.content.length > 1} | ||
<ol class="carousel-indicators"> | ||
{foreach idx, slide in ctrl.content} | ||
<li class="{'active': idx === ctrl.internalIndex}" onclick="{ctrl.navigate(idx)}"></li> | ||
{/foreach} | ||
</ol> | ||
{/if} | ||
<div class="carousel-inner"> | ||
{foreach idx, slide in ctrl.content} | ||
<div class="{'item','active': idx === ctrl.internalIndex, | ||
'prev': idx === ctrl.nextIndex && ctrl.ongoingNavigation === "prev", | ||
'next': idx === ctrl.nextIndex && ctrl.ongoingNavigation === "next", | ||
'left': (idx === ctrl.internalIndex || idx === ctrl.nextIndex) && ctrl.navigationDirection === "left", | ||
'right':(idx === ctrl.internalIndex || idx === ctrl.nextIndex) && ctrl.navigationDirection === "right"}"> | ||
<#slide.body/> | ||
{if slide.caption} | ||
<div class="carousel-caption"> | ||
<#slide.caption/> | ||
</div> | ||
{/if} | ||
</div> | ||
{/foreach} | ||
</div> | ||
{if ctrl.content.length > 1 && !(!ctrl.wrap && ctrl.internalIndex === 0)} | ||
<a class="left carousel-control" onclick="{ctrl.prev()}"> | ||
<span class="glyphicon glyphicon-chevron-left"></span> | ||
</a> | ||
{/if} | ||
{if ctrl.content.length > 1 && !(!ctrl.wrap && ctrl.internalIndex === (ctrl.content.length - 1))} | ||
<a class="right carousel-control" onclick="{ctrl.next()}"> | ||
<span class="glyphicon glyphicon-chevron-right"></span> | ||
</a> | ||
{/if} | ||
</div> | ||
{/template} |
Oops, something went wrong.