1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

better sidebar on/off class; precise jump from outline

This commit is contained in:
Lu Wang 2013-01-29 00:38:07 +08:00
parent f45e650e7d
commit e09a4cd78e
3 changed files with 16 additions and 12 deletions

View File

@ -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;

View File

@ -39,7 +39,7 @@ new pdf2htmlEX.Viewer('pdf-main', 'pdf-outline');
<title></title>
</head>
<body>
<div id="pdf-outline">
<div id="pdf-outline" class="opened">
"""
$outline

View File

@ -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) {