我正在为gmail编写一个google小工具。我是gadgets.for一个小工具的新手,我首先将一个html页面转换为模块,用于google gadget.i使用此模块规范
<Module>
<ModulePrefs title="Cloud Factor Demo" scrolling="false" description="Cloud Factor Demo Design" author="Ritesh Mehandiratta" author_email="..." author_location="Mountain View, CA">
<Require feature="dynamic-height" />
<Require feature="google.contentmatch"></Require>
</ModulePrefs>
<!-- Define the content type and display location. The settings
"html" and "card" are required for all Gmail contextual gadgets. -->
<Content type="html" view="card"><![CDATA[
但是当我转到我的gmail页面时,这个html处于滚动模式。我想让它的高度与删除此滚动所需的高度相同?这是滚动的截图
答案 0 :(得分:1)
默认情况下,小工具高200像素。如果要使用动态高度功能,请按照以下步骤操作
在ModulePrefs标记中添加<Require feature="dynamic-height" />
,您已经这样做了。无论何时,只要你觉得高度应该刷新,请拨打gadgets.window.adjustHeight();
示例 - 如果您希望在页面加载期间完成它,
<script>
function onPageLoaded() {
gadgets.window.adjustHeight();
}
</script>
<body onload="onPageLoaded()">
有关详细信息,请关注Google开发人员链接 - https://developers.google.com/gadgets/docs/ui#Dyn_Height