kaerus-component-slideshow 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2b177ae3b9027ad2f42ce55788bf92a50e63359
|
4
|
+
data.tar.gz: fd45fb2fdc3e33e03836b6a2b74c8bd5821f5a17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff6839c359de533a3079dc1f081274c304b9024e397b23ac0bba2f53b73785827d2612881060fca6c4cc748d8a6cd5270a94fdad9f2ff1c136ea8536c7086904
|
7
|
+
data.tar.gz: f3b807e34d12c45f6208952e4afc00504807048c02ba88bdda8cd14050614a858ed9977d607489bb04e4f8491be7dfd4a9221fd77e93d82e1429ae9c00b06a7f
|
@@ -223,8 +223,12 @@ function Carousel(container,tag) {
|
|
223
223
|
}
|
224
224
|
}
|
225
225
|
|
226
|
-
|
227
|
-
|
226
|
+
/* clone some nodes if we have to few slides */
|
227
|
+
var min_slides = 3;
|
228
|
+
|
229
|
+
if(nodes.length === 2) min_slides = 4;
|
230
|
+
|
231
|
+
for(var i = 0; nodes.length < min_slides; i++){
|
228
232
|
nodes[nodes.length] = nodes[i].cloneNode(true);
|
229
233
|
container.appendChild(nodes[nodes.length-1]);
|
230
234
|
}
|
@@ -565,7 +569,7 @@ Slideshow.prototype = {
|
|
565
569
|
slideshow.next();
|
566
570
|
event.stopPropagation();
|
567
571
|
});
|
568
|
-
|
572
|
+
|
569
573
|
addEvent(prev,'click',function(event){
|
570
574
|
slideshow.prev();
|
571
575
|
event.stopPropagation();
|
@@ -580,12 +584,19 @@ Slideshow.prototype = {
|
|
580
584
|
|
581
585
|
if(!elem) return;
|
582
586
|
|
583
|
-
if(Array.isArray
|
587
|
+
if(Array.isArray(prop)){
|
584
588
|
prop = getStyleProperty(prop);
|
585
589
|
}
|
586
590
|
|
587
591
|
if(!prop) return;
|
588
592
|
|
593
|
+
if(Array.isArray(elem)){
|
594
|
+
for(var i = 0, l = elem.length; i < l; i++)
|
595
|
+
applyStyle(elem[i],prop,attr);
|
596
|
+
|
597
|
+
return;
|
598
|
+
}
|
599
|
+
|
589
600
|
if(typeof attr == 'string'){
|
590
601
|
style = attr;
|
591
602
|
}
|
@@ -649,8 +660,7 @@ Slideshow.prototype = {
|
|
649
660
|
/* apply transitions after first slide */
|
650
661
|
/* to avoid animations on startup */
|
651
662
|
if(!slideshow.hasTransitions){
|
652
|
-
|
653
|
-
applyStyle(settings.id + '-s' + i,transitionProp,transition);
|
663
|
+
applyTransitions(document.getElementById(settings.id + '-slides'));
|
654
664
|
slideshow.hasTransitions = true;
|
655
665
|
}
|
656
666
|
}
|
@@ -662,6 +672,18 @@ Slideshow.prototype = {
|
|
662
672
|
|
663
673
|
addTransitionEndHandler(slides);
|
664
674
|
|
675
|
+
function applyTransitions(container){
|
676
|
+
var childs = container.childNodes, elems = [];
|
677
|
+
|
678
|
+
for(var i = 0, l = childs.length; i < l; i++){
|
679
|
+
if(childs[i].nodeType === 1){
|
680
|
+
elems.push(childs[i]);
|
681
|
+
}
|
682
|
+
}
|
683
|
+
|
684
|
+
applyStyle(elems,transitionProp,transition);
|
685
|
+
}
|
686
|
+
|
665
687
|
function addTransitionEndHandler(elem){
|
666
688
|
var te, index = slideshow.carousel.index, x = index % lx;
|
667
689
|
|