var mview = $('#view .mview:last');
if (!Modernizr.ftouch) {
- $(mview).find('.content').perfectScrollbar();
+ $(mview).find('.content:not(.noscroll)').perfectScrollbar();
} else {
- $(mview).find('.content').css({overflowY: 'auto'});
+ $(mview).find('.content:not(.noscroll)').css({overflowY: 'auto'});
}
var from = {y: "-200px", opacity: 0};
} else {
fullscreen = true;
}
- this.fluidbook.mobilefirst.resizeIndex();
break;
case 'share':
w = 200;
} else {
fullscreen = true;
}
- this.fluidbook.mobilefirst.resizeIndex();
} else {
var max = Math.floor((ww * 0.8) / 120) * 120 + 40;
w = Math.min(max, Math.max(m.find('.doubleThumb').length, 4) * 120 + 40);
var ratio = $("#archivesview img").width() / w;
$("#archivesview .links").transform({scale: [ratio]});
}
+
+ if (m.data('menu') === 'index' || m.data('menu') === 'bookmarks') {
+ this.fluidbook.mobilefirst.resizeIndex();
+ }
},
resizePopupAudios: function () {
return footer;
},
- resizeIndex: function () {
+ resizeIndex: function (repeat) {
+
if (!this.enabled) {
return;
}
+
+
+ if (repeat === undefined) {
+ repeat = true;
+ }
+
+ // Disable view scroll
+ $("#indexView").closest('.content').removeClass('ps').css('overflow', 'hidden');
$("#indexViewHolder").css('width', $("#indexViewHolder .doubleThumb").length * 130);
+
+
+ // Cut tall pages
+ var tallerHeight = 0;
+ $("#indexViewHolder .pageholder img").each(function () {
+ tallerHeight = Math.max(tallerHeight, $(this).outerHeight())
+ });
+ var indexHeight = tallerHeight + 120;
+ var maxHeight = parseFloat($(".mview .content").css('max-height'));
+ var funcHeight = $(".mview .fonctions").outerHeight() || 0;
+ var scrollAmount = Math.max(0, (indexHeight + funcHeight) - maxHeight);
+
+ if (!isNaN(scrollAmount) && scrollAmount > 0) {
+
+ var cutHeight = tallerHeight - scrollAmount;
+ $("#indexViewHolder .pageholder img").each(function () {
+ var holder = $(this).closest('.pageholder');
+ var thumb = holder.closest('.thumb');
+ var number = thumb.find('.number');
+ var doubleThumb = holder.closest('.doubleThumb');
+ if ($(this).outerHeight() > cutHeight) {
+ holder.addClass('cut').css('max-height', cutHeight);
+ thumb.css('height', cutHeight).addClass('cut');
+ doubleThumb.css('height', cutHeight);
+ number.css('top', cutHeight - 5);
+ } else {
+ holder.css('max-height', null).removeClass('cut');
+ doubleThumb.css('height', doubleThumb.data('height'));
+ number.css('top', number.data('top'));
+ thumb.removeClass('cut');
+ }
+ })
+ } else {
+ $("#indexViewHolder .pageholder").css('max-height', null).removeClass('cut');
+ $("#indexViewHolder .number").each(function () {
+ $(this).css('top', $(this).data('top'));
+ });
+ $("#indexViewHolder .doubleThumb").each(function () {
+ $(this).css('height', $(this).data('height'));
+ });
+ $("#indexViewHolder .thumb").removeClass('cut');
+ }
+
+ // Perfect scrollbar
setTimeout(function () {
$("#indexViewHolder").perfectScrollbar('update');
$("#indexViewHolder").find('.ps__rail-x').addClass('ps--clicking');
});
$("#indexViewHolder").find('.ps__rail-x').addClass('ps--clicking');
- // Cut tall pages
- $("#indexViewHolder .pageholder.cut").css('max-height', null).removeClass('cut');
- var scrollAmount = Math.max(0, $("#indexView").outerHeight() - parseFloat($(".mview .content").css('max-height')));
- console.log('scrollamount', scrollAmount);
- if (scrollAmount > 0) {
- var tallerHeight = 0;
- $("#indexViewHolder .pageholder img").each(function () {
- tallerHeight = Math.max(tallerHeight, $(this).outerHeight())
- });
- console.log(tallerHeight);
- var cutHeight = tallerHeight - scrollAmount;
- console.log(tallerHeight, cutHeight);
- $("#indexViewHolder .pageholder img").each(function () {
- if ($(this).outerHeight() > cutHeight) {
- var holder = $(this).closest('.pageholder');
- holder.addClass('cut').css('max-height', cutHeight);
- holder.closest('.thumb').css('height', cutHeight);
- holder.closest('.doubleThumb').css('height', cutHeight);
- }
- })
+ if (repeat) {
+ var $this = this;
+ setTimeout(function () {
+ $this.resizeIndex(false);
+ }, 200);
}
+ $("#indexView").css('opacity', 1);
},
}
\ No newline at end of file
getNormalView: function () {
if (this.normalHTML === '') {
- this.normalHTML += '<div class="content"><div id="indexView">';
+ var contentClass = 'content';
+ if (this.fluidbook.mobilefirst.enabled) {
+ contentClass += ' noscroll';
+ }
+
+ this.normalHTML += '<div class="' + contentClass + '"><div id="indexView">';
if (this.fluidbook.datas.indexMessage !== '') {
this.normalHTML += '<div id="indexViewMessage">' + this.fluidbook.datas.indexMessage + '</div>';
if (this.fluidbook.mobilefirst.enabled) {
var ph = this.fluidbook.loader.getPageDimensions(page, 100).height;
h = ' style="height:' + ph + 'px;"'
- pnt = ' style="top:' + (ph - 5) + 'px;"';
- dth = ' style="height:' + ph + 'px;"';
+ pnt = ' style="top:' + (ph - 5) + 'px;" data-top="' + (ph - 5) + '"';
+ dth = ' style="height:' + ph + 'px;" data-height="' + ph + '" ';
}
return {thumb: h, pagenumber: pnt, pageheight: ph, doublethumb: dth};
},