this.support = new FluidbookSupport(this);
this.search = new FluidbookSearch(this);
this.mobilefirst = new FluidbookMobileFirst(this);
- if (!this.mobilefirst.enabled) {
- this.slider = new FluidbookSlider(this);
- }
+
this.displayOnePage = this.alwaysDisplayOnePage = this.settings.mobileNavigationType === 'portrait' || (this.pad && this.pad.enabled) || this.mobilefirst.enabled;
this.zoom = new FluidbookZoom(this);
this.zoom.resetZoom();
this.cache = new FluidbookCache(this.settings);
this.service = new FluidbookService(this, this.settings.id);
this.loader = new FluidbookLoader(this);
+ if (!this.mobilefirst.enabled) {
+ this.slider = new FluidbookSlider(this);
+ }
this.pad = new FluidbookPad(this);
this.scorm = new FluidbookScorm(this);
this.links = new FluidbookLinks(this);
function FluidbookSlider(fluidbook) {
+ var $this = this;
this.fluidbook = fluidbook;
this.sliderWidth = 0;
this.cursorWidth = 0;
this.snapsWidth = 0;
this.snapsCount = 0;
- this.init();
+ this.hasSliderLink = false;
+ this.hasSlider = false;
+ if (this.fluidbook.settings.pagesBar) {
+ this.init();
+ }
+ $this.initSliderLink();
}
FluidbookSlider.prototype = {
+
+ initSliderLink: function () {
+ if (this.hasSliderLink) {
+ return;
+ }
+ if (this.fluidbook.settings.links.slider.length === 0) {
+ return;
+ }
+ this.hasSliderLink = true;
+ $("#interface").append('<div id="sliderlinks" style="width:' + this.fluidbook.settings.sliderImageDimensions[0] + 'px;height:' + this.fluidbook.settings.sliderImageDimensions[1] + 'px;" aria-hidden="true"><img src="data/interface/' + this.fluidbook.settings.sliderImage + '" class="back"><div class="links">' + this.fluidbook.loader.handleExtension(this.fluidbook.settings.links.slider) + '</div></div>');
+ },
+
init: function () {
+ this.hasSlider = true;
var $this = this;
$(document).on(this.fluidbook.input.clickEvent, function () {
$("#slider").removeClass('drag');
},
resize: function (ww, hh, single) {
+ if (this.hasSlider) {
+ this.resizeSlider(ww, hh, single);
+ }
+ if (this.hasSliderLink) {
+ this.resizeSliderLink(ww, hh, single);
+ }
+ },
+
+ resizeSliderLink: function (ww, hh, single) {
+ var r = document.getElementById("fluidbook").getBoundingClientRect();
+ var scale = r.width / this.fluidbook.settings.sliderImageDimensions[0];
+ var h = this.fluidbook.settings.sliderImageDimensions[1] * scale;
+ css = {
+ left: r.left,
+ top: (r.top + r.height) + ((hh - r.top - r.height - h) / 2),
+ transform: "scale(" + scale + ")"
+ };
+ $("#sliderlinks").css(css);
+ },
+
+ resizeSlider: function (ww, hh, singler) {
if (single) {
this.sliderWidth = ww / 2;
} else {