Skip to content

Commit 379ea38

Browse files
committed
refractored the code, improved docs
1 parent a4d7ca1 commit 379ea38

11 files changed

Lines changed: 198 additions & 221 deletions

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
Flexible Bootstrap Carousel plugin
44

55
##Introducing
6-
This plugin makes possible showing different numbers of items in your Bootstrap carousel depending on the browser's window width. In fact it creates several columns in each item of a Bootstrap carousel. Then it is watching if the width of a browser window is changing and is adjusting number of columns in each item respectively to window's size (in this version of the plugin - from 1 through 3 columns).
6+
This plugin makes possible showing different numbers of entities in each item of your Bootstrap carousel depending on the browser's window width.
7+
The content of each entity might be either simple (an image, for example)
8+
or complicated (as a product description with several images, selectors of sizes, colors etc... in internet-store).
9+
Actually the plugin creates several columns in each item of a Bootstrap carousel.
10+
Then it is watching if the width of a browser window is changing and is adjusting number of columns in each item respectively to window's size
11+
(in this version of the plugin - from 1 through 3 columns).
712
To see the plugin in action visit this [showcase](http://flexcarousel.surge.sh)
813

914
##Dependencies
@@ -50,7 +55,8 @@ Instead of linking the flexible-bootstrap-carousel.css file to your web-page you
5055

5156
```
5257

53-
To initiate the plugin you just need to add a *.flexible* class name to some Bootstrap carousel in your html code
58+
To initiate the plugin you might add some additional class name to those Bootstrap carousels which you want to turn into flexible ones.
59+
Suppose, it is a *.flexible* class name:
5460

5561
```html
5662
<div class="carousel flexible slide" data-ride="carousel" data-interval="5000" data-wrap="true">
@@ -60,7 +66,8 @@ To initiate the plugin you just need to add a *.flexible* class name to some Boo
6066
</div>
6167
```
6268

63-
Then you need to create inside of the carousel a container with class name of *.items*. You also should put the items, which you want to appear in the carousel, into this container (each of them should have class of *.item*).
69+
Then you need to create inside of the carousel a container with class name of *.items*. You also should put the items, which you want to appear in the carousel,
70+
into this container (each of them should have class of *.item*).
6471

6572
```html
6673
<div class="carousel flexible slide" data-ride="carousel" data-interval="5000" data-wrap="true">
@@ -108,8 +115,29 @@ Then you need to create inside of the carousel a container with class name of *.
108115

109116
You can leave empty container with class name of *.carousel-inner*.
110117

118+
Finally, you just have to add next code to your JavaScript file:
119+
120+
```javascript
121+
122+
$(".carousel.flexible").flexCarousel();
123+
124+
```
125+
111126
You've done it! Enjoy of your page with built in flexible Bootstrap carousel.
112127

128+
##Adjusting contents of the entities of the carousel
129+
130+
If the content of the entities of your carusel is complicated enough, you might want to adjust it each time when the carousel changes number of elements inside each item.
131+
To do so you can use the event *aCarouselHasBeenAdjusted*, that is triggered each time when the carousel has been adjusted:
132+
133+
```javascript
134+
135+
$(".carousel.flexible").on("aCarouselHasBeenAdjusted", function() {
136+
// do something
137+
});
138+
139+
```
140+
113141
##License
114142

115143
This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/DanDevG/flexible-bootstrap-carousel/blob/master/LICENSE.md) file for details
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/*!
2+
3+
Flexible Bootstrap Carousel v0.3.1
4+
5+
Copyright (c) 2017 Dan Dev
6+
7+
Released under the MIT license
8+
https://github.com/DanDevG/flexible-bootstrap-carousel/master/LICENSE.md
9+
10+
*/
11+
112
.carousel.flexible .items {
213
display: none;
314
}

examples/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414

1515
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
1616
<script type="text/javascript" src="js/bootstrap.js"></script>
17-
<script type="text/javascript" src="js/FitText.js-master/jquery.fittext.js"></script>
1817
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.1/js/bootstrap-select.min.js"></script>
19-
<script type="text/javascript" src="js/flexible-bootstrap-carousel.js"></script>
18+
<script type="text/javascript" src="js/flexible-bootstrap-carousel.min.js"></script>
2019
<script type="text/javascript" src="js/script.js"></script>
2120

2221
<title>Flexible Bootstrap Carousel</title>

examples/js/flexible-bootstrap-carousel.js

Lines changed: 0 additions & 111 deletions
This file was deleted.

examples/js/flexible-bootstrap-carousel.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/js/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $(window).load(function() {
99
adjustIndexesOfCarousel();
1010
});
1111

12-
adjustAllCarousels();
12+
$(".carousel.flexible").flexCarousel();
1313
});
1414

1515
function sizeChoosing() {

flexible-bootstrap-carousel.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
3-
Flexible Bootstrap Carousel v0.4
3+
Flexible Bootstrap Carousel v0.3.1
44
55
Copyright (c) 2017 Dan Dev
66

0 commit comments

Comments
 (0)