Skip to content

Commit 65bfe45

Browse files
committed
Updated version
1 parent d6e36bd commit 65bfe45

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

dist/slideshow.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ function Slideshow(_ref) {
168168

169169

170170
var interval = function () {
171-
if (duration > 0 && typeof Interval === 'function') {
172-
new Interval({
171+
if (duration > 0 && 'Interval' in window) {
172+
return new Interval({
173173
callback: function callback() {
174174
that.next();
175175
},
@@ -339,7 +339,7 @@ function Slideshow(_ref) {
339339
/**
340340
* Sets the current slide.
341341
*
342-
* @param {number|HTMLElement|Node} slide Index of the element or the
342+
* @param {string|number|HTMLElement|Node} slide Index of the element or the
343343
* element itself to bet setted as
344344
* current.
345345
*
@@ -356,7 +356,11 @@ function Slideshow(_ref) {
356356

357357
this.set = function (slide) {
358358
if (slide == null) {
359-
throw new Error('The given element is not a valid value. Please, insert an integer or a DOM element.');
359+
throw new Error('The given element is not a valid value. Please, insert a string, an integer or a DOM element.');
360+
}
361+
362+
if (typeof slide === 'string') {
363+
slide = document.querySelector(slide);
360364
}
361365

362366
if (typeof slide === 'number') {
@@ -374,7 +378,7 @@ function Slideshow(_ref) {
374378
throw new Error('The given element is not in this slideshow.');
375379
}
376380
} else {
377-
throw new Error('The given element is not a valid value. Please, insert an integer or a DOM element.');
381+
throw new Error('The given element is not a valid value. Please, insert a string, an integer or a DOM element.');
378382
}
379383

380384
var oldCurrent = current;
@@ -471,6 +475,11 @@ function Slideshow(_ref) {
471475
};
472476

473477
if (interval) {
474-
interval.startInterval();
478+
interval.startInterval({
479+
callback: function callback() {
480+
that.next();
481+
},
482+
ms: duration
483+
});
475484
}
476485
}

dist/slideshow.js.min.map

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

dist/slideshow.min.js

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

docs/slideshow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Slideshow
44
**Kind**: global class
5-
**Version**: 1.0.1
5+
**Version**: 1.0.2
66
**Author:** Gennaro Landolfi <[email protected]>
77

88
* [Slideshow](#Slideshow)

src/slideshow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @param {boolean} [param.swipe=false]
1414
* @param {boolean} [param.throwsSlideIndexError=false]
1515
*
16-
* @version 1.0.2
16+
* @version 1.0.3
1717
*
1818
* @author Gennaro Landolfi <[email protected]>
1919
*/

0 commit comments

Comments
 (0)