@@ -401,7 +401,40 @@ define([
401
401
* @param {Boolean } isInternal - Is this function called via breakpoints.
402
402
*/
403
403
updateOptions : function ( configuration , isInternal ) {
404
+
405
+ var $selectable =
406
+ $ ( 'a[href], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]' )
407
+ . not ( '[tabindex=-1], [disabled], :hidden' ) ,
408
+ fotorama = settings . fotoramaApi ,
409
+ $focus = $ ( ':focus' ) ,
410
+ index ;
411
+
412
+ /**
413
+ * Displays navigation arrows on preview if it contains ifraime.
414
+ * @param fotorama - object of fotorama
415
+ */
416
+ function showArrows ( fotorama ) {
417
+ var $arrows = $ ( '[data-gallery-role="arrow"]' ) ;
418
+
419
+ if ( ( fotorama . activeFrame . $stageFrame . find ( ':has(iframe)' ) . length && fotorama . fullScreen ) ||
420
+ ( fotorama . fullScreen && config . fullscreen . arrows ) ||
421
+ ( ! fotorama . fullScreen && config . arrows ) ) {
422
+ $arrows . show ( ) ;
423
+ } else {
424
+ $arrows . hide ( ) ;
425
+ }
426
+ } ;
427
+
404
428
if ( _ . isObject ( configuration ) ) {
429
+
430
+ //Saves index of focus
431
+ $selectable . each ( function ( number ) {
432
+
433
+ if ( $ ( this ) . is ( $focus ) ) {
434
+ index = number ;
435
+ }
436
+ } ) ;
437
+
405
438
if ( this . isTouchEnabled ) {
406
439
configuration . arrows = false ;
407
440
}
@@ -419,6 +452,11 @@ define([
419
452
}
420
453
$ . extend ( true , settings . currentConfig . options , configuration ) ;
421
454
settings . fotoramaApi . setOptions ( settings . currentConfig . options ) ;
455
+ showArrows ( fotorama ) ;
456
+
457
+ if ( _ . isNumber ( index ) ) {
458
+ $selectable . eq ( index ) . focus ( ) ;
459
+ }
422
460
}
423
461
} ,
424
462
0 commit comments