diff --git a/share/base.css b/share/base.css index 1c7767f..9f08f31 100644 --- a/share/base.css +++ b/share/base.css @@ -10,6 +10,10 @@ margin:0px; padding:0 0 0 7px; background-color:#707070; + display:none; +} +#pdf-outline.opened { + display:block; } #pdf-outline ul { margin-left:13px; @@ -36,7 +40,7 @@ #pdf-main { /* PDF container */ position:absolute; top:0; - left:200px; + left:0px; bottom:0; right:0; overflow:auto; @@ -47,6 +51,9 @@ margin:0; border-width:0; } +#pdf-outline.opened + #pdf-main { + left:200px; +} #pdf-main .d { /* page decoration */ position:relative; margin: 13px auto; diff --git a/share/manifest b/share/manifest index c21a58e..6afd97d 100644 --- a/share/manifest +++ b/share/manifest @@ -39,7 +39,7 @@ new pdf2htmlEX.Viewer('pdf-main', 'pdf-outline'); -
+
""" $outline diff --git a/share/pdf2htmlEX.js b/share/pdf2htmlEX.js index d3edd1a..84e0eb2 100644 --- a/share/pdf2htmlEX.js +++ b/share/pdf2htmlEX.js @@ -114,17 +114,12 @@ var pdf2htmlEX = (function(){ }, init_after_loading_content : function() { + this.outline = $('#'+this.outline_id); this.container = $('#'+this.container_id); - // hide sidebar if there is no outline items - { - // need a better design - // e.g. class for sidebar on/off & selector rule for pdf-main - var sidebar = $('#'+this.outline_id); - if(sidebar.children().length == 0) { - sidebar.hide(); - this.container.offset({left:0}); - } + // need a better design + if(this.outline.children().length == 0) { + this.outline.toggleClass('opened'); } var new_pages = new Array(); @@ -142,7 +137,9 @@ var pdf2htmlEX = (function(){ //this.zoom_fixer(); // used by outline/annot_link etc + // note that one is for the class 'a' and the other is for the tag 'a' this.container.on('click', '.a', this, this.link_handler); + this.outline.on('click', 'a', this, this.link_handler); this.render(); }, @@ -242,7 +239,7 @@ var pdf2htmlEX = (function(){ get_containing_page : function(obj) { /* get the page obj containing obj */ var p = obj.closest('.p')[0]; - return p && this.pages[(new Page(p).n]; + return p && this.pages[(new Page(p)).n]; }, link_handler : function (e) {