@@ -91,7 +91,8 @@ fotoramaVersion = '4.6.4';
91
91
verticalImageClass = _fotoramaClass + '_vertical_ratio' ;
92
92
var JQUERY_VERSION = $ && $ . fn . jquery . split ( '.' ) ;
93
93
94
- var borderPos = 0 ;
94
+ var borderPos = 0 ,
95
+ curSlide = 1 ;
95
96
96
97
if ( ! JQUERY_VERSION
97
98
|| JQUERY_VERSION [ 0 ] < 1
@@ -1616,9 +1617,9 @@ fotoramaVersion = '4.6.4';
1616
1617
if ( $el . selector !== '.fotorama__nav-wrap .fotorama__nav .fotorama__nav__shaft' ) {
1617
1618
$el . css ( $ . extend ( getDuration ( options . time ) , translate ) ) ;
1618
1619
1619
- if ( $el . selector === ".fotorama__thumb-border" ) {
1620
+ if ( $el . selector === "." + thumbBorderClass ) {
1620
1621
1621
- var slideLength = Math . floor ( $el . closest ( '.fotorama__wrap' ) . width ( ) / options . thumb . width ) ,
1622
+ var slideLength = Math . floor ( $el . closest ( '.' + wrapClass ) . width ( ) / options . thumb . width ) ,
1622
1623
borderStep = options . thumb . margin ,
1623
1624
slidePosition ;
1624
1625
@@ -1642,7 +1643,8 @@ fotoramaVersion = '4.6.4';
1642
1643
}
1643
1644
}
1644
1645
}
1645
- borderPos = options . pos ;
1646
+ borderPos = options . pos ;
1647
+ curSlide = Math . floor ( borderPos / borderStep / slideLength ) + 1 ;
1646
1648
}
1647
1649
}
1648
1650
}
@@ -1655,7 +1657,7 @@ fotoramaVersion = '4.6.4';
1655
1657
} else {
1656
1658
$el . stop ( ) . animate ( translate , options . time , BEZIER , onEndFn ) ;
1657
1659
options . measures . nw = - slidePosition + borderStep * ( slideLength - 1 ) ;
1658
- $ ( '.fotorama__nav__shaft' ) . css ( $ . extend ( getDuration ( options . time ) , translate ) ) ;
1660
+ $ ( '.' + navShaftClass ) . css ( $ . extend ( getDuration ( options . time ) , translate ) ) ;
1659
1661
}
1660
1662
}
1661
1663
@@ -1666,7 +1668,7 @@ fotoramaVersion = '4.6.4';
1666
1668
} else {
1667
1669
options . measures . nw = - slidePosition + borderStep * ( slideLength - 1 ) ;
1668
1670
}
1669
- $ ( '.fotorama__nav__shaft' ) . css ( $ . extend ( getDuration ( options . time ) , translate ) ) ;
1671
+ $ ( '.' + navShaftClass ) . css ( $ . extend ( getDuration ( options . time ) , translate ) ) ;
1670
1672
}
1671
1673
1672
1674
function fade ( $el1 , $el2 , $frames , options , fadeStack , chain ) {
@@ -2498,6 +2500,7 @@ fotoramaVersion = '4.6.4';
2498
2500
2499
2501
lastOptions = $ . extend ( { } , opts ) ;
2500
2502
setStagePosition ( ) ;
2503
+ that . showSlide ( curSlide ) ;
2501
2504
}
2502
2505
2503
2506
function normalizeIndex ( index ) {
@@ -2748,7 +2751,11 @@ fotoramaVersion = '4.6.4';
2748
2751
setTimeout ( function ( ) {
2749
2752
lockScroll ( $nav ) ;
2750
2753
} , 0 ) ;
2751
- slideNavShaft ( { time : o_transitionDuration , guessIndex : $ ( this ) . data ( ) . eq , minMax : navShaftTouchTail } ) ;
2754
+ if ( ! opts . carouselnavigation ) {
2755
+ slideNavShaft ( { time : o_transitionDuration , guessIndex : $ ( this ) . data ( ) . eq , minMax : navShaftTouchTail } ) ;
2756
+ } else {
2757
+ that . showSlide ( Math . floor ( $ ( this ) . data ( ) . eq / slidesNumb ) + 1 )
2758
+ }
2752
2759
} ) ;
2753
2760
}
2754
2761
@@ -3187,12 +3194,12 @@ fotoramaVersion = '4.6.4';
3187
3194
}
3188
3195
3189
3196
that . showSlide = function ( index ) {
3190
- if ( ( index > 0 ) && ( index <= $navShaft . children ( ) . length - 1 ) ) {
3197
+ if ( index > 0 && activeFrame ) {
3191
3198
index -- ;
3192
3199
var borderStep = opts . navdir === 'vertical' ?
3193
3200
opts . thumbheight + opts . thumbmargin :
3194
3201
opts . thumbwidth + opts . thumbmargin ,
3195
- slideLength = Math . floor ( $el . closest ( '.fotorama__wrap' ) . width ( ) / opts . thumbwidth ) ,
3202
+ slideLength = Math . floor ( $ ( '.' + wrapClass ) . width ( ) / opts . thumbwidth ) ,
3196
3203
options = {
3197
3204
time : opts . transitionduration ,
3198
3205
direction : opts . navdir ,
@@ -3337,6 +3344,10 @@ fotoramaVersion = '4.6.4';
3337
3344
showedFLAG = typeof lastActiveIndex !== 'undefined' && lastActiveIndex !== activeIndex ;
3338
3345
lastActiveIndex = activeIndex ;
3339
3346
3347
+ if ( opts . carouselnavigation ) {
3348
+ that . showSlide ( curSlide ) ;
3349
+ }
3350
+
3340
3351
return this ;
3341
3352
} ;
3342
3353
@@ -3782,7 +3793,7 @@ fotoramaVersion = '4.6.4';
3782
3793
onEnd : function ( result ) {
3783
3794
3784
3795
function onEnd ( ) {
3785
- slideNavShaft . l = opts . carouselnavigation ? slideDrag . slidePosition : result . newPos ;
3796
+ slideNavShaft . l = opts . carouselnavigation ? slideDrag . slidePosition : result . newPos ;
3786
3797
releaseAutoplay ( ) ;
3787
3798
changeAutoplay ( ) ;
3788
3799
thumbsDraw ( result . newPos , true ) ;
0 commit comments