function FluidbookLinks(fluidbook) {
this.fluidbook = fluidbook;
+ this.lastTriggeredLinksPage = -1;
try {
this.zoom = new FluidbookLinksZoom(fluidbook);
} catch (e) {
this.lowdef = this.fluidbook.support.android || this.fluidbook.support.iOS;
+
$(this.fluidbook).on('fluidbook.page.change.end', function () {
+ if ($this.lastTriggeredLinksPage == $this.fluidbook.currentPage) {
+ return;
+ }
+ $this.lastTriggeredLinksPage = $this.fluidbook.currentPage;
var pages = $this.fluidbook.getDisplayedPages();
var links = [];
$.each(pages, function (k, page) {
$.each($this.fluidbook.settings.triggersLinks, function (j, triggers) {
if (triggers.page == page && links.indexOf(triggers.link) === -1) {
- links.push(triggers.link);
+ links.push({link: triggers.link, delay: triggers.delay});
}
});
});
$.each(links, function (k, link) {
- $this.triggerLinkById(link);
+ console.log
+ setTimeout(function () {
+ $this.triggerLinkById(link.link);
+ }, link.delay * 1000);
});
});
});
$(document).on(this.fluidbook.input.clickEvent, '[data-showid]:not([data-showmode="showonhover"])', function () {
- var mode = $(this).data('showmode');
+ var mode = $(this).data('showmode');
var ids = $(this).data('showid').toString().split(',');
if (mode === 'hide') {
selector += ':not([data-id$="' + id + '"])';
});
$(selector).each(function () {
- $this.hidePlacedLink(this, (mode === 'shownext' || mode === 'shownextcycle') ? 500 : 0);
+ var timeout = (mode === 'shownext' || mode === 'shownextcycle') ? 500 : 0;
+ if ($(selector).is('[data-animation-hide]')) {
+ timeout = 0;
+ }
+ $this.hidePlacedLink(this, timeout);
});
}
});
}, 10);
-
$(l).trigger('fluidbook.link.show');
if (close !== 'none') {
$(l).removeClass('notinteractive');
$(l).find('img').css('pointer-events', 'none');
}
setTimeout(function () {
+ if ($(l).is('[data-animation-hide]') && !$(l).hasClass('show')) {
+ $this.animateContentLink($(l), true, true, 0);
+ }
$(l).addClass('show');
}, 10);
});
});
},
- animateContentLink: function (link, autostart) {
- if ($(link).data('animation-started') === true) {
+ animateContentLink: function (link, autostart, force, delay) {
+
+ if (force === undefined) {
+ force = false;
+ }
+ if (!force && $(link).data('animation-started') === true) {
return;
}
if (autostart === undefined) {
}
});
+ var override = {};
+ if (delay !== undefined) {
+ override.delay = delay;
+ }
$.each(animations, function (k, animation) {
- $this.executeAnimation(link, $.extend({}, firstDefaults, animation), autoStartThisAnim);
+ $this.executeAnimation(link, $.extend({}, firstDefaults, animation, override), autoStartThisAnim);
});
},