Skip to content

Commit b6c37c1

Browse files
committed
Refactored last merge.
Renamed interval and speed options to more semantic names. Added visual control to toggle the slideshow. Added SVG icons.
1 parent 5a12162 commit b6c37c1

15 files changed

+110
-49
lines changed

README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Add the following HTML snippet with the Gallery widget to the body of your webpa
2626
<a class="prev">‹</a>
2727
<a class="next">›</a>
2828
<a class="close">×</a>
29+
<a class="play-pause"></a>
2930
<ol class="indicator"></ol>
3031
</div>
3132
```
@@ -61,8 +62,6 @@ Initialize the Gallery the following way:
6162
```js
6263
var links = document.getElementById('links').getElementsByTagName('a'),
6364
options = {
64-
// Start an automatic slideshow with a delay of 5 seconds between slides:
65-
interval: 5000,
6665
// Set to true to initialize the Gallery with carousel specific options:
6766
carousel: false
6867
},
@@ -95,6 +94,8 @@ var options = {
9594
leftEdgeClass: 'blueimp-gallery-left',
9695
// The class to add when the right edge has been reached:
9796
rightEdgeClass: 'blueimp-gallery-right',
97+
// The class to add when the automatic slideshow is active:
98+
playingClass: 'blueimp-gallery-playing',
9899
// The class for all slides:
99100
slideClass: 'slide',
100101
// The slide class for loading elements:
@@ -117,6 +118,8 @@ var options = {
117118
nextClass: 'next',
118119
// The class for the "close" control:
119120
closeClass: 'close',
121+
// The class for the "play-pause" toggle control:
122+
playPauseClass: 'play-pause',
120123
// The class for the active indicator:
121124
activeClass: 'active',
122125
// The list object property (or data attribute) with the object type:
@@ -145,6 +148,8 @@ var options = {
145148
stretchImages: false,
146149
// Toggle the controls on pressing the Return key:
147150
toggleControlsOnReturn: true,
151+
// Toggle the automatic slideshow interval on pressing the Space key:
152+
toggleSlideshowOnSpace: true,
148153
// Navigate the gallery by pressing left and right on the keyboard:
149154
enableKeyboardNavigation: true,
150155
// Close the gallery on pressing the ESC key:
@@ -164,22 +169,21 @@ var options = {
164169
// Allow continuous navigation, moving from last to first
165170
// and from first to last slide:
166171
continuous: true,
167-
// The number of elements to load around the current index:
168-
preloadRange: 2,
172+
// Start with the automatic slideshow:
173+
startSlideshow: false,
174+
// Delay in milliseconds between slides for the automatic slideshow:
175+
slideshowInterval: 5000,
169176
// The starting index as integer.
170177
// Can also be an object of the given list,
171178
// or an equal object with the same url property:
172179
index: 0,
173-
// Delay in milliseconds between slides for slideshow
174-
interval: 4000,
175-
// Auto-start gallery slideshow
176-
autoSlideshow: false,
180+
// The number of elements to load around the current index:
181+
preloadRange: 2,
177182
// The transition speed between slide changes in milliseconds:
178-
speed: 400,
179-
// The transition speed between slideshow slide changes in milliseconds:
180-
slideshowSpeed: 1000,
181-
// Toggle slideshow on pressing the Space key:
182-
toggleSlideshowOnSpace: true,
183+
transitionSpeed: 400,
184+
// The transition speed for automatic slide changes, set to an integer
185+
// greater 0 to override the default transition speed:
186+
slideshowTransitionSpeed: undefined,
183187
// Callback function executed on slide change.
184188
// Is called with the list object as "this" object and the
185189
// current index and slide as arguments:
@@ -201,12 +205,13 @@ If the **carousel** option is **true**, the following options are set to differe
201205
var carouselOptions = {
202206
hidePageScrollbars: false,
203207
toggleControlsOnReturn: false,
208+
toggleSlideshowOnSpace: false,
204209
enableKeyboardNavigation: false,
205210
closeOnEscape: false,
206211
closeOnSlideClick: false,
207212
closeOnSwipeUpOrDown: false,
208213
disableScroll: false,
209-
interval: 5000 // 5 seconds
214+
startSlideshow: true
210215
};
211216
```
212217

@@ -240,7 +245,7 @@ gallery.next();
240245
// Move to the given slide index with the (optional) given duraction speed in milliseconds:
241246
gallery.slide(index, duration);
242247

243-
// Start an automatic slideshow with the given delay:
248+
// Start an automatic slideshow with the given delay (optional):
244249
gallery.play(delay);
245250

246251
// Stop the automatic slideshow:

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-gallery",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"title": "blueimp Gallery",
55
"description": "blueimp Gallery is a touch-enabled, responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers. It features swipe, mouse and keyboard navigation, transition effects, slideshow functionality, fullscreen support and on-demand content loading and can be extended to display additional content types.",
66
"keywords": [

css/blueimp-gallery.css

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@charset 'UTF-8';
22
/*
3-
* blueimp Gallery CSS 2.0.1
3+
* blueimp Gallery CSS 2.3.0
44
* https://github.com/blueimp/Gallery
55
*
66
* Copyright 2013, Sebastian Tschan
@@ -85,8 +85,7 @@
8585
margin: -64px auto 0;
8686
width: 128px;
8787
height: 128px;
88-
background: url(../img/play.png) center no-repeat;
89-
background-size: 64px 64px;
88+
background: url(../img/video-play.png) center no-repeat;
9089
cursor: pointer;
9190
}
9291
.blueimp-gallery > .slides > .slide > .video-playing > a,
@@ -109,7 +108,6 @@
109108
}
110109
.blueimp-gallery > .slides > .slide-error {
111110
background: url(../img/error.png) center no-repeat;
112-
background-size: 64px 64px;
113111
}
114112
.blueimp-gallery > .slides > .slide-error > .slide-content {
115113
display: none;
@@ -151,33 +149,47 @@
151149
}
152150
.blueimp-gallery > .close,
153151
.blueimp-gallery > .title {
154-
margin: 0 60px 0 0;
155152
position: absolute;
156153
top: 15px;
157154
left: 15px;
155+
margin: 0 40px 0 0;
158156
font-size: 20px;
159157
line-height: 30px;
160158
color: #fff;
161159
text-shadow: 0 0 2px #000;
162160
display: none;
163161
}
164162
.blueimp-gallery > .close {
165-
margin: -15px;
166163
padding: 15px;
167164
right: 15px;
168165
left: auto;
166+
margin: -15px;
169167
font-size: 30px;
170168
text-decoration: none;
171169
opacity: 0.8;
172170
cursor: pointer;
173171
}
172+
.blueimp-gallery > .play-pause {
173+
position: absolute;
174+
right: 15px;
175+
bottom: 15px;
176+
width: 15px;
177+
height: 15px;
178+
background: url(../img/play-pause.png) 0 0 no-repeat;
179+
cursor: pointer;
180+
opacity: 0.8;
181+
display: none;
182+
}
183+
.blueimp-gallery-playing > .play-pause {
184+
background-position: -15px 0;
185+
}
174186
.blueimp-gallery > .indicator {
175187
position: absolute;
176188
top: auto;
177189
right: 15px;
178190
bottom: 15px;
179191
left: 15px;
180-
margin: 0;
192+
margin: 0 40px;
181193
padding: 0;
182194
list-style: none;
183195
text-align: center;
@@ -214,6 +226,7 @@
214226
.blueimp-gallery-controls > .next,
215227
.blueimp-gallery-controls > .close,
216228
.blueimp-gallery-controls > .title,
229+
.blueimp-gallery-controls > .play-pause,
217230
.blueimp-gallery-controls > .indicator {
218231
display: block;
219232
/* Fix z-index issues (controls behind slide element) on Android: */
@@ -227,10 +240,22 @@
227240
.blueimp-gallery-left > .prev,
228241
.blueimp-gallery-single > .next,
229242
.blueimp-gallery-right > .next,
243+
.blueimp-gallery-single > .play-pause,
230244
.blueimp-gallery-single > .indicator {
231245
display: none;
232246
}
233247

248+
/* Replace PNGs with SVGs for capable browsers (excluding IE<9) */
249+
body:last-child .blueimp-gallery > .slides > .slide > .video-content > a {
250+
background-image: url(../img/video-play.svg);
251+
}
252+
body:last-child .blueimp-gallery > .slides > .slide-error {
253+
background-image: url(../img/error.svg);
254+
}
255+
body:last-child .blueimp-gallery > .play-pause {
256+
background-image: url(../img/play-pause.svg);
257+
}
258+
234259
@media (max-width: 767px) {
235260
.blueimp-gallery-carousel {
236261
height: 270px;

css/blueimp-gallery.min.css

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

img/error.png

-6.28 KB
Loading

img/error.svg

Lines changed: 5 additions & 0 deletions
Loading

img/play-pause.png

606 Bytes
Loading

img/play-pause.svg

Lines changed: 6 additions & 0 deletions
Loading

img/play.png

-11.5 KB
Binary file not shown.

img/video-play.png

2.75 KB
Loading

img/video-play.svg

Lines changed: 5 additions & 0 deletions
Loading

index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE HTML>
22
<!--
33
/*
4-
* blueimp Gallery Demo 2.0.0
4+
* blueimp Gallery Demo 2.3.0
55
* https://github.com/blueimp/Gallery
66
*
77
* Copyright 2013, Sebastian Tschan
@@ -42,6 +42,7 @@ <h2>Carousel image gallery</h2>
4242
<h3 class="title"></h3>
4343
<a class="prev"></a>
4444
<a class="next"></a>
45+
<a class="play-pause"></a>
4546
</div>
4647
<br>
4748
<h2>Carousel video gallery</h2>
@@ -51,6 +52,7 @@ <h2>Carousel video gallery</h2>
5152
<h3 class="title"></h3>
5253
<a class="prev"></a>
5354
<a class="next"></a>
55+
<a class="play-pause"></a>
5456
</div>
5557
<br>
5658
<h2>Lightbox image gallery</h2>
@@ -63,6 +65,7 @@ <h3 class="title"></h3>
6365
<a class="prev"></a>
6466
<a class="next"></a>
6567
<a class="close">×</a>
68+
<a class="play-pause"></a>
6669
<ol class="indicator"></ol>
6770
</div>
6871
<script src="js/blueimp-gallery.js"></script>

0 commit comments

Comments
 (0)