},
setOptions: function () {
+ this.hideOnPages = this.fluidbook.settings.tabsHideOnPages;
this.hideOnLastPage = this.fluidbook.settings.tabsHideOnLastPage;
this.hideOnFirstPage = this.fluidbook.settings.tabsHideOnCover;
this.hideOnPortrait = this.fluidbook.settings.tabsHideOnPortrait;
}
$(this.fluidbook).on('fluidbook.page.change.start', function (e, page) {
- if ($this.hideOnFirstPage) {
- if (page <= 1) {
- $this.changeVisibility('firstpage', false);
- }
- }
- if ($this.hideOnLastPage) {
- var last = $this.fluidbook.settings.pages;
- if (last % 2 === 1) {
- last--;
- }
- if (page >= last) {
- $this.changeVisibility('lastpage', false);
- }
- }
+ $this.checkPageVisibility();
$this.changePage(page);
});
$(this.fluidbook).on('fluidbook.page.change.end', function (e, page) {
- if ($this.hideOnFirstPage) {
- if (page > 1) {
- $this.changeVisibility('firstpage', true);
- }
- }
- if ($this.hideOnLastPage) {
- var last = $this.fluidbook.settings.pages;
- if (last % 2 === 1) {
- last--;
- }
- if (page < last) {
- $this.changeVisibility('lastpage', true);
- }
- }
+ $this.checkPageVisibility();
});
$(document).on('mouseover', '.tablink[data-labelid]', function () {
});
},
+ checkPageVisibility(){
+ var $this=this;
+ var pages = this.fluidbook.getDisplayedPages();
+ var hide = false;
+ $.each(pages, function (k, p) {
+ if ($this.hideOnPages.indexOf(p) >= 0) {
+ hide = true;
+ return false;
+ }
+ });
+ this.changeVisibility('firstpage', !hide);
+ },
+
changeVisibility: function (type, visible) {
this.visibility[type] = visible;
var tabsvisible = true;