<path d="M20.8,8.5c-0.9,0-1.6-0.7-1.6-1.6s0.7-1.6,1.6-1.6s1.6,0.7,1.6,1.6S21.7,8.5,20.8,8.5z M20.8,6.6
c-0.1,0-0.2,0.1-0.2,0.2c0,0.2,0.4,0.2,0.4,0C21,6.7,20.9,6.6,20.8,6.6z"/>
</symbol>
+ <symbol id="chevron-bold" viewBox="0 0 2.5 3.5">
+ <polygon points="0.7,0 2.5,1.8 0.7,3.5 0,2.8 1.1,1.8 0,0.7"/>
+ </symbol>
</svg>
function FluidbookVacheronSlideshow(fluidbook) {
this.fluidbook = fluidbook;
+ this.initEvents();
}
FluidbookVacheronSlideshow.prototype = {
- initSlideshow: function (id) {
+
+ initEvents: function () {
+ var $this = this;
+ $(document).on('click', '.fb-slideshow-wrapper.vacheron .fb-slideshow-nav-next', function () {
+ $this.gotoNextIndex($(this).closest('.fb-slideshow'));
+ return false;
+ });
+
+ $(document).on('click', '.fb-slideshow-wrapper.vacheron .fb-slideshow-nav-prev', function () {
+ $this.gotoPrevIndex($(this).closest('.fb-slideshow'));
+ return false;
+ });
+
+ $(document).on('click', '.fb-slideshow-wrapper.vacheron .fb-slideshow-nav-index', 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 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>');
+ $(s).append(nav);
+ this.gotoIndex(0, $(s));
+ },
+
+ normalizeIndex: function (i, nb) {
+ return (i + nb * 2) % nb;
+ },
+
+ gotoNextIndex: function (s) {
+ this.gotoIndex($(s).data('currentIndex') + 1, s);
+ },
+
+ gotoPrevIndex: function (s) {
+ this.gotoIndex($(s).data('currentIndex') - 1, s);
+ },
+
+ gotoIndex: function (i, s) {
+ var $this = this;
+ if ($(s).data('animating')) {
+ return;
+ }
+ i = this.normalizeIndex(i, $(s).data('nbslides'));
+ if (i === $(s).data('currentIndex')) {
+ return;
+ }
+ $(s).data('animating', true);
+
+ var next = $(s).find('.fb-slideshow-slide:eq(' + i + ')');
+ $(next).addClass('animating');
+ var current = $(s).find('.fb-slideshow-slide.show');
+ setTimeout(function () {
+ $(s).data('currentIndex', i);
+ $(s).find('[data-index]').removeClass('active');
+ $(s).find('[data-index="' + i + '"]').addClass('active');
+ $(next).one($this.fluidbook.support.getTransitionEndEvent(), function () {
+ $(next).removeClass('animating');
+ $(current).removeClass('show');
+ $(s).data('animating', false);
+ }).addClass('show');
+ }, 10);
+ },
+
+ resize: function (ww, hh, m) {
+ var fullscreen = false;
+ var w, h;
+ var s = $(m).find('.fb-slideshow-wrapper');
+ m.find('.caption, .back').addClass('nocaption');
+ if (ww < 800) {
+ fullscreen = true;
+ w = ww;
+ h = hh;
+ } else {
+ var navheight = 75;
+ var meta = $(s).find('.fb-slideshow-slide:eq(0) img').data('meta');
+ var scale = Math.min(((hh * 0.9) - navheight) / meta.height, (ww * 0.9) / meta.width);
+ w = meta.width * scale;
+ 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};
}
};
-@import "../variables";
\ No newline at end of file
+@import "../variables";
+
+.mview[data-menu="slideshow"] a.back {
+ z-index: 3;
+}
+
+.fb-slideshow-wrapper.vacheron {
+ background-color: #fff;
+
+ .fb-slideshow-thumbnails {
+ display: none;
+ }
+
+ .fb-slideshow {
+ width: 100%;
+ height: ~"calc(100% - 75px)";
+
+ .fb-slideshow-slide {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: ~"calc(100% - 75px)";
+ z-index: 1;
+ opacity: 0;
+
+ img {
+ object-fit: contain;
+ width: 100%;
+ height: 100%;
+ }
+
+ &.animating {
+ z-index: 2;
+ opacity: 0;
+ transition: opacity 700ms;
+ }
+
+ &.show {
+ opacity: 1;
+ }
+ }
+
+ .fb-slideshow-nav {
+ position: absolute;
+ bottom: 15px;
+
+ .fb-slideshow-nav-prev, .fb-slideshow-nav-next {
+ @w: 40px;
+ display: inline-block;
+ width: @w;
+ height: @w;
+ border-radius: 50%;
+ border: 1px solid #333;
+ margin: 0 10px;
+ color: #333;
+ font-size: 8px;
+ font-weight: bold;
+ padding: unit(@w/2, px);
+ line-height: 0;
+ vertical-align: bottom;
+ text-align: center;
+
+ svg {
+ color: #333;
+ position: relative;
+ top: -3px;
+ left: -2px;
+ width: 5px;
+ }
+ }
+
+ .fb-slideshow-nav-prev {
+ svg {
+ transform: rotate(180deg);
+ }
+ }
+
+ .fb-slideshow-nav-index {
+ @w: 9px;
+ display: inline-block;
+ margin: 0 10px;
+ width: @w;
+ height: @w;
+ background-color: #888a8c;
+ border-radius: 50%;
+ position: relative;
+ top: -13px;
+ border: 3px solid #fff;
+
+ &:hover, &.active {
+ background-color: #9a8155;
+ border-color: #9a8155;
+ }
+ }
+ }
+
+ }
+}
\ No newline at end of file