FluidbookSlider.prototype = {
init: function () {
- $("#interface").append('<div id="slider"><div id="sliderback"><div class="visible"></div></div><div id="slidercursor"><div class="visible"></div></div></div>');
+ $("#interface").append('<div id="slider"><div id="sliderthumb"><div class="doubleThumb"><div class="thumb left"><a href="#"><img src=""></a><span class="number"></span><a href="#" class="bookmark left"></a></div><div class="thumb right"><a href="#"><img src="data/thumbnails/p3.jpg"></a><span class="number"></span><a href="#" class="bookmark right"></a></div></div></div><div id="sliderback"><div class="visible"></div></div><div id="slidercursor"><div class="visible"></div></div></div>');
var $this = this;
$(this.fluidbook).on('fluidbook.page.change.end', function (e, page) {
$this.updateCursorPosition();
interact(document.getElementById("slidercursor")).draggable({
inertia: false,
+ onstart: function (event) {
+ return $this.dragCursor(event, false);
+ },
onmove: function (event) {
return $this.dragCursor(event, false);
},
},
dragCursor: function (e, end) {
- if(!end) {
- $("#slider").addClass(".drag");
- }else{
- $("#slider").removeClass(".drag");
+ if (!end) {
+ $("#slider").addClass("drag");
+ } else {
+ $("#slider").removeClass("drag");
}
this.updatePageByCursorPosition(this.pageToSlider(e.pageX), end, true);
},
left = this.snapsWidth * (current / 2);
}
$("#slidercursor").css('left', left);
- }
+
+ if ($("#sliderthumb").is(':visible')) {
+ this.updateThumb(page);
+ $("#sliderthumb").css('left', left + (this.cursorWidth / 2) - (230 / 2));
+ }
+ },
+
+ updateThumb: function (page) {
+ var left = 0;
+ var right = 0;
+ var single = false;
+ if (this.fluidbook.resize.orientation == 'portrait') {
+ single = true;
+ left = page;
+ } else {
+ if (page % 2 == 1) {
+ page--;
+ }
+ if (page > 0) {
+ left = page;
+ }
+ if (page <= this.fluidbook.datas.pages) {
+ right = page + 1;
+ }
+ }
+
+ if (single) {
+ $("#sliderthumb .doubleThumb").addClass('single');
+ } else {
+ $("#sliderthumb .doubleThumb").removeClass('single');
+ if (left == 0 || right == 0) {
+ $("#sliderthumb .doubleThumb").addClass('simple');
+ if (left == 0) {
+ $("#sliderthumb .doubleThumb").addClass('right');
+ } else {
+ $("#sliderthumb .doubleThumb").removeClass('right');
+ }
+
+ if (right == 0) {
+ $("#sliderthumb .doubleThumb").addClass('left');
+ } else {
+ $("#sliderthumb .doubleThumb").removeClass('left');
+ }
+ }
+ }
+
+
+ if (left != 0) {
+ var t=$("#sliderthumb .doubleThumb").find('.thumb.left');
+ }
+
+ if (right == 0) {
+
+ } else {
+
+ }
+ },
};
\ No newline at end of file
}
}
- .doubleThumb {
- height: @thumb-height;
- &.left {
- margin-right: 10px;
- }
- &.simple {
- .overlay {
- width: 100px;
- }
- &.left {
- .hits {
- left: -50px;
- }
- }
- &.right {
- .hits {
- left: 50px;
- }
- }
+}
- }
+.doubleThumb {
+ height: @thumb-height;
+ &.left {
+ margin-right: 10px;
+ }
+ &.simple {
.overlay {
- background-color: rgba(0, 0, 0, 0.5);
- position: absolute;
- top: 0px;
- left: 0px;
- width: 200px;
- z-index: 4;
+ width: 100px;
}
-
- @hits-top: (@thumb-height - 26) / 2;
-
- .hits {
- position: relative;
- display: inline;
-
- z-index: 5;
- font-size: 12px;
- height: 26px;
- top: @hits-top;
- &.yes {
- padding: 5px;
- border-radius: 1px;
- color: @menu-text;
- background-color: @menu-background;
+ &.left {
+ .hits {
+ left: -50px;
+ }
+ }
+ &.right {
+ .hits {
+ left: 50px;
}
}
- }
- .padding {
- height: 1px;
}
-
- .thumb {
+ .overlay {
+ background-color: rgba(0, 0, 0, 0.5);
position: absolute;
top: 0px;
left: 0px;
- font-size: 12px;
+ width: 200px;
+ z-index: 4;
+ }
- img {
- width: 100px;
- height: @thumb-height;
- background: #fff;
- position: relative;
- z-index: 1;
- }
- .number {
- text-align: center;
- display: block;
- font-family: Arial, Helvetica, sans-serif;
- margin: 1px 0 0 0;
- max-width: 100px;
- position: relative;
- z-index: 1;
- }
- &.right {
- left: 100px;
- }
- &.simple {
- width: 100px;
- &.right {
- margin-left: 110px;
- }
- }
- &.left {
- margin-right: 110px;
+ @hits-top: (@thumb-height - 26) / 2;
+
+ .hits {
+ position: relative;
+ display: inline;
+
+ z-index: 5;
+ font-size: 12px;
+ height: 26px;
+ top: @hits-top;
+ &.yes {
+ padding: 5px;
+ border-radius: 1px;
+ color: @menu-text;
+ background-color: @menu-background;
}
+ }
+}
- @shade-height: unit(@thumb-height+22, px);
- &:before {
- position: absolute;
- content: "";
- background-image: url("../images/icon-shad.png");
- background-size: 100% 100%;
- background-repeat: no-repeat;
- opacity: 0.65;
- top: -5px;
- left: -5px;
- width: 111px;
- height: @shade-height;
- z-index: 0;
+.padding {
+ height: 1px;
+}
+
+.thumb {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ font-size: 12px;
+
+ img {
+ width: 100px;
+ height: @thumb-height;
+ background: #fff;
+ position: relative;
+ z-index: 1;
+ }
+ .number {
+ text-align: center;
+ display: block;
+ font-family: Arial, Helvetica, sans-serif;
+ margin: 1px 0 0 0;
+ max-width: 100px;
+ position: relative;
+ z-index: 1;
+ }
+ &.right {
+ left: 100px;
+ }
+ &.simple {
+ width: 100px;
+ &.right {
+ margin-left: 110px;
}
+ }
+ &.left {
+ margin-right: 110px;
+ }
+ @shade-height: unit(@thumb-height+22, px);
+ &:before {
+ position: absolute;
+ content: "";
+ background-image: url("../images/icon-shad.png");
+ background-size: 100% 100%;
+ background-repeat: no-repeat;
+ opacity: 0.65;
+ top: -5px;
+ left: -5px;
+ width: 111px;
+ height: @shade-height;
+ z-index: 0;
}
+
}
/* Search */