Resize properly the iframe

This commit is contained in:
Las Zenow 2012-09-02 15:40:43 +02:00
parent 7a35b283b5
commit 7449fbd877
3 changed files with 6 additions and 15 deletions

View file

@ -6,7 +6,6 @@
</footer> </footer>
<!-- Placed at the end of the document so the pages load faster --> <!-- Placed at the end of the document so the pages load faster -->
<script src="/js/jquery.js"></script>
<script src="/js/bootstrap-modal.js"></script> <script src="/js/bootstrap-modal.js"></script>
<script src="/js/bootstrap-dropdown.js"></script> <script src="/js/bootstrap-dropdown.js"></script>
<script src="/js/bootstrap-alert.js"></script> <script src="/js/bootstrap-alert.js"></script>

View file

@ -9,6 +9,7 @@
.down { vertical-align:text-bottom; } .down { vertical-align:text-bottom; }
</style> </style>
<title>Imperial Library of Trantor</title> <title>Imperial Library of Trantor</title>
<script src="/js/jquery.js"></script>
</head> </head>
<body> <body>
<!-- login screen --> <!-- login screen -->

View file

@ -32,23 +32,14 @@
{{end}} {{end}}
</div> </div>
<div class="span8">
<script type="text/javascript"> <script type="text/javascript">
function iframedoc(aID){ function resizeIframe() {
var framecont = null; $("#bookContent").height($("#bookContent").contents().find("html").height());
var frame=document.getElementById(aID);
if(frame.contentDocument)
framecont = frame.contentDocument;
else
framecont = document.frames[aID].document;
return framecont;
}
function iframe_resize(){
var myframe = document.getElementById('txt');
var frameDoc = iframedoc('txt');
myframe.height = frameDoc.body.offsetHeight+20;
} }
</script> </script>
<iframe class="span8" id="txt" onload="iframe_resize();" scrolling="no" src="{{.Content}}" seamless="seamless"></iframe> <iframe id="bookContent" onload="resizeIframe();" style="width: 100%; border: none;" src="{{.Content}}" seamless="seamless"></iframe>
</div>
</div> </div>
<ul class="pager"> <ul class="pager">