});
$("#sliderback").on('click', function (e) {
+ if ($this.fluidbook.transitionning) {
+ return;
+ }
var left = e.pageX - $(this).offset().left;
- $this.updatePageByCursorPosition(left);
+ $this.updatePageByCursorPosition(left, true);
});
},
- updatePageByCursorPosition: function (pos) {
- var snap = Math.floor(pos / this.snapsWidth);
- if (this.fluidbook.orientation == 'portrait') {
- this.fluidbook.setCurrentPage(snap);
- } else {
- this.fluidbook.setCurrentPage(snap * 2);
+ updatePageByCursorPosition: function (pos, updateCursor) {
+ if (updateCursor == undefined) {
+ updateCursor = false;
+ }
+
+ var page = Math.floor(pos / this.snapsWidth);
+ if (this.fluidbook.orientation != 'portrait') {
+ page *= 2;
+ }
+ this.fluidbook.setCurrentPage(page);
+ if (updateCursor) {
+ this.updateCursorPosition(page);
}
return false;
},
if (single) {
this.sliderWidth = ww / 2;
} else {
- this.sliderWidth = ww / 3;
+ this.sliderWidth = this.fluidbook.resize.getScreenFluidbookWidth() * 0.4;
}
this.sliderWidth = Math.round(this.sliderWidth);
- $("#slider").css({width: this.sliderWidth, left: (ww - this.sliderWidth) / 2, top: hh - 32});
+ var bottom = 26;
+ if (single) {
+ bottom = 18;
+ }
+
+ $("#slider").css({width: this.sliderWidth, left: (ww - this.sliderWidth) / 2, top: hh - bottom});
this.updateSnaps(single);
this.cursorWidth = Math.max(30, this.snapsWidth);
$("#slidercursor").css('width', this.cursorWidth);
this.snapsWidth = this.sliderWidth / this.snapsCount;
},
- updateCursorPosition: function () {
-
+ updateCursorPosition: function (page) {
+ if (page == undefined) {
+ page = this.fluidbook.currentPage;
+ }
var left;
if (this.fluidbook.resize.orientation == 'portrait') {
- left = this.snapsWidth * (Math.max(1, this.fluidbook.currentPage) - 1);
+ left = this.snapsWidth * (Math.max(1, page) - 1);
} else {
- var current = this.fluidbook.currentPage;
- if (current % 2 == 1 && this.fluidbook.currentPage != this.fluidbook.datas.pages) {
+ var current = page;
+ if (current % 2 == 1 && page != this.fluidbook.datas.pages) {
current--;
}
left = this.snapsWidth * (current / 2);
}
-
$("#slidercursor").css('left', left);
}
};
\ No newline at end of file