Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H3nr1ke lateral arrows #86

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ Work on a Vue instance:
| auto | Number | Delay of auto slide | 3000 |
| continuous | Boolean | Create an infinite slider without endpoints | true |
| showIndicators | Boolean | Show indicators on slider bottom | true |
| showArrows | Boolean | Show lateral centered arrows | false |
| leftArrow | String | image to be displayed as left arrow | the char "<" |
| rightArrow | String | image to be displayed as right arrow | the char ">" |
| noDragWhenSingle | Boolean | Do not drag when there is only one swipe-item | true |
| prevent | Boolean | `preventDefault` when touch start, useful for some lower version Android Browser (4.2, etc) | false |
| propagation | Boolean | solve nesting | false |
Expand Down
41 changes: 41 additions & 0 deletions src/swipe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@
.mint-swipe-indicator.is-active {
background: #fff;
}
.mint-swipe-arrow-left,
.mint-swipe-arrow-right{
position: absolute;
height: 100%;
top: 0;
font-size: 3em;
display: flex;
justify-content: center;
align-items: center;
padding: 0 20px;
}
.mint-swipe-arrow-left{
left: 0;
}
.mint-swipe-arrow-right{
right: 0;
}
</style>

<template>
Expand All @@ -54,8 +71,17 @@
<div class="mint-swipe-indicator"
v-for="(page, $index) in pages"
:key="$index"
@click="goto($index)"
:class="{ 'is-active': $index === index }"></div>
</div>
<div class="mint-swipe-arrow-left" @click="prev()" v-show="showArrows">
<img :src="leftArrow" v-if="leftArrow !== ''" />
<span v-else>&lt;</span>
</div>
<div class="mint-swipe-arrow-right" @click="next()" v-show="showArrows">
<img :src="rightArrow" v-if="rightArrow !== ''" />
<span v-else>&gt;</span>
</div>
</div>
</template>

Expand Down Expand Up @@ -128,6 +154,21 @@
propagation: {
type: Boolean,
default: false
},

showArrows: {
type: Boolean,
default: false
},

leftArrow: {
type: String,
default: ""
},

rightArrow: {
type: String,
default: ""
}

},
Expand Down