mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
auto hide sidebar if empty
This commit is contained in:
parent
f16e346e65
commit
821ae624d2
@ -33,7 +33,7 @@ $css
|
||||
|
||||
"""
|
||||
<script type="text/javascript">
|
||||
new pdf2htmlEX.Viewer('pdf-main');
|
||||
new pdf2htmlEX.Viewer('pdf-main', 'pdf-outline');
|
||||
</script>
|
||||
|
||||
<title></title>
|
||||
|
@ -94,8 +94,9 @@ var pdf2htmlEX = (function(){
|
||||
}
|
||||
});
|
||||
|
||||
pdf2htmlEX.Viewer = function(container_id) {
|
||||
pdf2htmlEX.Viewer = function(container_id, outline_id) {
|
||||
this.container_id = container_id;
|
||||
this.outline_id = outline_id;
|
||||
this.init_before_loading_content();
|
||||
|
||||
var _ = this;
|
||||
@ -115,6 +116,17 @@ var pdf2htmlEX = (function(){
|
||||
init_after_loading_content : function() {
|
||||
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});
|
||||
}
|
||||
}
|
||||
|
||||
var new_pages = new Array();
|
||||
var pl= $('.p', this.container);
|
||||
/* don't use for(..in..) */
|
||||
|
Loading…
Reference in New Issue
Block a user