Skip to content

Commit

Permalink
Fix multi instances (#67)
Browse files Browse the repository at this point in the history
Thanks
  • Loading branch information
Fedik authored and brianteeman committed Jan 9, 2018
1 parent 9e69aec commit d81bea8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions media/com_wrapper/js/iframe-height.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
function iFrameHeight()
function iFrameHeight(iframe)
{
var height = 0;
var iframe = document.querySelectorAll('*[id^="blockrandom"]');
var doc = 'contentDocument' in iframe ? iframe.contentDocument : iframe.contentWindow.document;
var height = parseInt(doc.body.scrollHeight);

if (!document.all)
{
height = doc.body.scrollHeight;
iframe.style.height = parseInt(height) + 60 + 'px';
}
else if (document.all)
else if (document.all && iframe.id)
{
height = doc.body.scrollHeight;
document.all.blockrandom.style.height = parseInt(height) + 20 + 'px';
document.all[iframe.id].style.height = parseInt(height) + 20 + 'px';
}
}
2 changes: 1 addition & 1 deletion media/com_wrapper/js/iframe-height.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion modules/mod_wrapper/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function getParams(&$params)
// Auto height control
if ($params->def('height_auto'))
{
$load = 'onload="iFrameHeight()"';
$load = 'onload="iFrameHeight(this)"';
}
else
{
Expand Down

0 comments on commit d81bea8

Please sign in to comment.