if (this.fluidbook.slideshow) {
this.fluidbook.slideshow.clear();
}
- $(".inlineslideshow").each(function () {
- if ($(this).is(':visible')) {
- $this.fluidbook.slideshow.initInlineSlideshow($(this));
- } else {
- var $s = $(this);
- $(this).closest('.link').on('fluidbook.link.show', function () {
- if (!$s.data('init')) {
- $this.fluidbook.slideshow.initInlineSlideshow($s);
- }
- });
- }
+
+ $("#links .fb-slideshow").each(function () {
+ $this.fluidbook.slideshow.initInlineSlideshow(this);
});
+ this.fluidbook.slideshow.resizeInline();
},
resize: function () {
}
return res;
},
+
+ callWhenLoaded: function (image, callback) {
+ $(image).one('load', function () {
+ callback();
+ });
+
+ $(image).one('error', function () {
+ callback();
+ });
+ var img = $(image).get(0);
+ if (img.complete || img.readyState === 'complete' || img.readyState === 4) {
+ callback();
+ }
+ },
+
retryErrorImages: function () {
$(this.imagesErrors).each(function () {
$(this).attr('src', $(this).attr('src'));
}, parseFloat(this.fluidbook.settings.inlineSlideshowDuration) * 1000));
},
+
+ resizeInline() {
+
+ },
};
function FluidbookSlideshow(fluidbook) {
this.fluidbook = fluidbook;
- this.instances = {inline: null, popup: null};
+ this.instances = {};
+
var $this = this;
- $.each(this.instances, function (k, v) {
- var s = (k === 'inline' ? $this.fluidbook.settings.inlineSlideshowLibrary : $this.fluidbook.settings.popupSlideshowLibrary);
+ $.each(['popup', 'inline'], function (k, v) {
+ var s = (v === 'inline' ? $this.fluidbook.settings.inlineSlideshowLibrary : $this.fluidbook.settings.popupSlideshowLibrary);
+ if ($this.instances[s] !== undefined) {
+ return;
+ }
switch (s) {
case 'dummy':
if (window.FluidbookDummySlideshow !== undefined) {
- $this.instances[k] = new FluidbookDummySlideshow($this.fluidbook);
+ $this.instances[s] = new FluidbookDummySlideshow($this.fluidbook);
}
case 'vacheron':
if (window.FluidbookVacheronSlideshow !== undefined) {
- $this.instances[k] = new FluidbookVacheronSlideshow($this.fluidbook);
+ $this.instances[s] = new FluidbookVacheronSlideshow($this.fluidbook);
}
break;
case undefined:
case 'splide':
default:
if (window.FluidbookSplideSlideshow !== undefined) {
- $this.instances[k] = new FluidbookSplideSlideshow($this.fluidbook);
+ $this.instances[s] = new FluidbookSplideSlideshow($this.fluidbook);
}
break;
}
});
- this.popupInstance = $this.instances['popup'];
- this.inlineInstance = $this.instances['inline'];
+ this.popupInstance = $this.instances[$this.fluidbook.settings.popupSlideshowLibrary];
+ this.inlineInstance = $this.instances[$this.fluidbook.settings.inlineSlideshowLibrary];
}
FluidbookSlideshow.prototype = {
} else if (context === 'inline') {
this.initInlineSlideshow(s);
}
- }
+ },
+
+ resizeInline: function () {
+ this.inlineInstance.resizeInline();
+ },
};
this.primarySlider.refresh();
return {w: w, h: h, fullscreen: fullscreen};
- }
+ },
+
+ resizeInline:function(){
+
+ },
};
$this.gotoIndex($(this).data('index'), $(this).closest('.fb-slideshow'));
return false;
});
+
},
initSlideshow: function (s) {
- $(s).closest('.fb-slideshow-wrapper').addClass('vacheron');
-
$(s).data('nbslides', $(s).find('.fb-slideshow-slide').length);
+ var context = $(s).closest('.fb-slideshow-wrapper').hasClass('fb-slideshow-inline') ? 'inline' : 'popup';
+ $(s).data('context', context);
- var nav = $('<nav class="fb-slideshow-nav"><a href="#" class="fb-slideshow-nav-prev">'+getSpriteIcon('chevron-bold')+'</a></nav>');
+ var nav = $('<nav class="fb-slideshow-nav"><a href="#" class="fb-slideshow-nav-prev">' + getSpriteIcon('chevron-bold') + '</a></nav>');
var i = 0;
$(s).find('.fb-slideshow-slide').each(function () {
$(nav).append('<a href="#" class="fb-slideshow-nav-index" data-index="' + i + '"></a>');
i++;
});
- $(nav).append('<a href="#" class="fb-slideshow-nav-next">'+getSpriteIcon('chevron-bold')+'</a>');
+ $(nav).append('<a href="#" class="fb-slideshow-nav-next">' + getSpriteIcon('chevron-bold') + '</a>');
$(s).append(nav);
- this.gotoIndex(0, $(s));
+ if (context === 'inline') {
+ $(s).data('currentIndex', 0);
+ } else {
+ this.gotoIndex(0, s);
+ }
+
+ this.fluidbook.loader.callWhenLoaded($(s).find('.fb-slideshow-slide:eq(1) img'), function () {
+ setTimeout(function () {
+ $(s).addClass('ready');
+ }, 100)
+ });
},
normalizeIndex: function (i, nb) {
},
gotoIndex: function (i, s) {
+ console.log('gotoindex', i, s);
var $this = this;
if ($(s).data('animating')) {
+ console.log('already animating');
return;
}
i = this.normalizeIndex(i, $(s).data('nbslides'));
if (i === $(s).data('currentIndex')) {
+ console.log('already index');
return;
}
$(s).data('animating', true);
$(current).removeClass('show');
$(s).data('animating', false);
}).addClass('show');
+
+ setTimeout(function () {
+ if ($(s).data('animating')) {
+ $(next).removeClass('animating');
+ $(current).removeClass('show');
+ $(s).data('animating', false);
+ }
+ }, 800);
+
}, 10);
},
h = navheight + (meta.height * scale);
}
-
$(s).css({width: w, height: h});
var nav = $(s).find('.fb-slideshow-nav');
$(nav).css('left', (w - $(nav).outerWidth()) / 2);
return {w: w, h: h, fullscreen: fullscreen};
- }
+ },
+
+ resizeInline: function () {
+ $('.fb-slideshow-wrapper.vacheron .fb-slideshow').each(function () {
+ $(this).closest('.link').css('pointer-events', 'none');
+ var s = $(this);
+ var nav = $(s).find('.fb-slideshow-nav');
+ $(nav).css('left', ($(s).closest('.link').outerWidth() - $(nav).outerWidth()) / 2);
+ });
+ },
};
z-index: 3;
}
+#links {
+ .fb-slideshow-wrapper.vacheron {
+ .fb-slideshow {
+ height: 100%;
+ opacity: 0;
+ transition: opacity 300ms;
+
+ &.ready {
+ opacity: 1;
+ }
+
+ .fb-slideshow-slide {
+ height: 100%;
+ }
+ }
+
+ .fb-slideshow-nav {
+ transform: scale(2);
+ transform-origin: 50% 50%;
+ bottom: -100px;
+ }
+ }
+}
+
.fb-slideshow-wrapper.vacheron {
background-color: #fff;
}
.fb-slideshow {
+
width: 100%;
height: ~"calc(100% - 75px)";
.fb-slideshow-slide {
+ pointer-events: none;
position: absolute;
top: 0;
left: 0;
height: ~"calc(100% - 75px)";
z-index: 1;
opacity: 0;
+ list-style: none;
img {
+ pointer-events: none;
object-fit: contain;
width: 100%;
height: 100%;
}
.fb-slideshow-nav {
+ pointer-events: auto;
position: absolute;
bottom: 15px;