Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Commit 6282f86

Browse files
author
Łukasz Florczak
authored
Merge pull request #41 from lukaszflorczak/develop
v0.3
2 parents e605209 + 65ca54f commit 6282f86

File tree

4 files changed

+442
-208
lines changed

4 files changed

+442
-208
lines changed

README.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# vue-agile
22

33
> Carousel component for Vue.js inspired by [Slick](https://github.com/kenwheeler/slick/).<br>
4-
> More powerfull with each version, touch-friendly, written in Vue and Vanilla JS (without jQuery dependency).
4+
> More powerful with each version, touch-friendly, written in Vue and Vanilla JS (without jQuery dependency).
55
66
**[Demo & examples](https://lukaszflorczak.github.io/vue-agile/)**
77

88
🤝 Thanks to [Maciej Wach](https://github.com/wachu91) for inventing the name, testing and motivation.
99

10+
## Important – update to version >= `0.3`
11+
12+
**In version `0.3.0`, I removed all styles that are responsible for the appearance of navigation elements** (like dots color and shape, arrows position, etc.). I think most people use their own styles and default styles are completely redundant. If you want to check out these defaults styles, you can find them [here](https://github.com/lukaszflorczak/vue-agile/blob/master/src/Agile.vue#L488).
13+
1014
## Installation
1115

1216
``` bash
@@ -56,11 +60,15 @@ Every first-level child of `<agile>` is a new slide.
5660
| autoplaySpeed | integer (ms) | `3000` | Autoplay interval in milliseconds |
5761
| dots | boolean | `true` | Enable dot indicators/pagination |
5862
| fade | boolean | `false` | Enable fade effect |
59-
| infinite | boolen | `true` | Infinite loop sliding |
63+
| infinite | boolean | `true` | Infinite loop sliding |
64+
| mobileFirst | boolean | `true` | Enable mobile first calculation for responsive settings |
65+
| options | object | `null` | All settings as one object |
6066
| pauseOnHover | boolean | `true` | Pause autoplay when a slide is hovered |
6167
| pauseOnDotsHover | boolean | `false` | Pause autoplay when a dot is hovered |
68+
| responsive | object | `null` | Object containing breakpoints and settings objects |
6269
| speed | integer (ms) | `300` | Slide animation speed in milliseconds |
6370
| timing | string | `ease` | Transition timing function <br> (`linear`/`ease`/`ease-in`/`ease-out`/`ease-in-out`) |
71+
| unagile | boolean | `false` | Disable agile carousel |
6472

6573
### Example
6674

@@ -70,6 +78,46 @@ Every first-level child of `<agile>` is a new slide.
7078
</agile>
7179
```
7280

81+
## Responsive
82+
83+
To customize responsiveness, I recommend defining desired breakpoint and passing a settings object with the options to modify inside **options**.
84+
85+
### Example
86+
87+
``` vue
88+
<agile :options="options">
89+
...
90+
</agile>
91+
```
92+
93+
``` js
94+
data () {
95+
return {
96+
options: {
97+
arrows: false,
98+
99+
responsive: [
100+
{
101+
breakpoint: 600,
102+
settings: {
103+
dots: false
104+
}
105+
},
106+
107+
{
108+
breakpoint: 900,
109+
settings: {
110+
arrows: true,
111+
dots: true,
112+
infinite: false
113+
}
114+
}
115+
]
116+
}
117+
}
118+
}
119+
```
120+
73121
## Arrows
74122

75123
By default carousel contains SVG arrows. You can change them using CSS or `prevArrow` & `nextArrow` parameters.

demo/App.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="container">
55
<div class="row">
66
<div class="col-xs-12">
7-
<h1 class="section__title">Demo of <strong>vue-agile</strong><span class="badge">0.2</span></h1>
7+
<h1 class="section__title">Demo of <strong>vue-agile</strong><span class="badge">0.3</span></h1>
88
<p class="section__description">vue-agile is a carousel component for Vue.js inspired by Slick. Simple, touch-friendly, written in Vue and Vanilla JS (without jQuery dependency).</p>
99

1010
<div class="gh-buttons visible-md">
@@ -39,7 +39,7 @@
3939

4040
<div class="row">
4141
<div class="col-xs-12">
42-
<agile>
42+
<agile :options="options">
4343
<div class="slide slide--1"><h3>slide 1</h3></div>
4444
<div class="slide slide--2"><h3>slide 2</h3></div>
4545
<div class="slide slide--3"><h3>slide 3</h3></div>
@@ -191,7 +191,7 @@
191191
&:hover {
192192
background-color: rgba(#000, .5);
193193

194-
#arrow-svg {
194+
svg {
195195
fill: #fff;
196196
}
197197
}
@@ -200,7 +200,7 @@
200200
display: none;
201201
}
202202

203-
#arrow-svg {
203+
svg {
204204
fill: rgba(#fff, .4);
205205
height: 25px;
206206
}

demo/scss/main.scss

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,128 @@ h1, h2, h3 {
3636
font-weight: 300;
3737
}
3838

39+
.agile {
40+
position: relative;
41+
42+
&, * {
43+
&:focus,
44+
&:active {
45+
outline: none;
46+
}
47+
}
48+
49+
&__list {
50+
display: block;
51+
margin: 0;
52+
overflow: hidden;
53+
padding: 0;
54+
position: relative;
55+
width: 100%;
56+
}
57+
58+
&__track {
59+
align-items: center;
60+
display: flex;
61+
justify-content: flex-start;
62+
63+
.agile--disabled & {
64+
display: block;
65+
max-width: 100%;
66+
}
67+
}
68+
69+
&__slide {
70+
display: block;
71+
72+
.agile--fade & {
73+
opacity: 0;
74+
position: relative;
75+
z-index: 0;
76+
77+
&--active {
78+
opacity: 1;
79+
z-index: 2;
80+
}
81+
82+
&--expiring {
83+
opacity: 1;
84+
transition-duration: 0s;
85+
z-index: 1;
86+
}
87+
}
88+
}
89+
90+
&__arrow {
91+
border: none;
92+
bottom: -11px;
93+
margin: 0;
94+
padding: 0;
95+
position: absolute;
96+
transition-duration: .3s;
97+
98+
&[disabled] {
99+
cursor: default;
100+
opacity: .4;
101+
}
102+
103+
&:hover {
104+
svg {
105+
fill: #333;
106+
}
107+
}
108+
109+
&--prev {
110+
left: 0;
111+
}
112+
113+
&--next {
114+
right: 0;
115+
}
116+
117+
svg {
118+
fill: #888;
119+
height: 24px;
120+
transition-duration: .3s;
121+
}
122+
}
123+
124+
&__dots {
125+
align-items: center;
126+
display: flex;
127+
justify-content: center;
128+
list-style: none;
129+
margin: 20px 0;
130+
padding: 0;
131+
text-align: center;
132+
white-space: nowrap;
133+
}
134+
135+
&__dot {
136+
margin: 0 10px;
137+
138+
button {
139+
background-color: #eee;
140+
border: none;
141+
border-radius: 50%;
142+
cursor: pointer;
143+
display: block;
144+
height: 10px;
145+
font-size: 0;
146+
line-height: 0;
147+
margin: 0;
148+
transition-duration: .3s;
149+
width: 10px;
150+
}
151+
152+
&--current,
153+
&:hover {
154+
button {
155+
background-color: #888;
156+
}
157+
}
158+
}
159+
}
160+
39161
.hidden-md {
40162
@include md {
41163
display: none;

0 commit comments

Comments
 (0)