留言板
Function to Auto Resize in Alloy
Hello Community,
I need to convert this script to AUI JS which I've never used before. My script below aims to resize an iframe on Liferay depending on the content :
Can I get some help from you ?
Regards,
Sofia.
I need to convert this script to AUI JS which I've never used before. My script below aims to resize an iframe on Liferay depending on the content :
<script language="javascript" type="text/javascript">
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}
</script>
Can I get some help from you ?
Regards,
Sofia.
David H Nebinger,修改在9 年前。
RE: Function to Auto Resize in Alloy
Liferay Legend 帖子: 14917 加入日期: 06-9-2 最近的帖子
Simple JS does not require conversion to alloy.
Thank you for the reply. I m using this script(as it is ) , and in the Html Attributes of my page , I add this line :
PS : #portlet_48_INSTANCE_NhIc03Ne857c is the Id of my Iframe portlet.
But it doesn't work, the Iframe doesn't auto-resize .
onload="resizeIframe(#portlet_48_INSTANCE_NhIc03Ne857c)"
PS : #portlet_48_INSTANCE_NhIc03Ne857c is the Id of my Iframe portlet.
But it doesn't work, the Iframe doesn't auto-resize .
David H Nebinger,修改在9 年前。
RE: Function to Auto Resize in Alloy
Liferay Legend 帖子: 14917 加入日期: 06-9-2 最近的帖子
First, you shouldn't be using onload. Liferay has facilities you should be using, i.e. Liferay.on('AllPortletsReady', function() {}); See https://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/javascript.
Second, #portlet_blah_blah_blah is not an object, it is merely an id. Objects are found at least by using getElementById() or AUI's facilities to find an element. Your passing who knows what as the argument, but that thing does not have the ability to resize.
Second, #portlet_blah_blah_blah is not an object, it is merely an id. Objects are found at least by using getElementById() or AUI's facilities to find an element. Your passing who knows what as the argument, but that thing does not have the ability to resize.