我正在尝试使用https://github.com/davidjbradshaw/iframe-resizer iframe,示例(https://github.com/davidjbradshaw/iframe-resizer/tree/master/example)似乎是基于JQuery的。有人知道如何在不使用JavaScript的情况下通过JQuery来调用它吗?它需要一个机构装载,还是我捕获装载事件的iframe?我对如何开始使用它感到困惑(调用它)。
Edit...to为每个问题添加了更多细节。
文件的主体是:
<iframe src="http://www.domain.net/store20/StoreTop.aspx?StoreID=17" width="100%" scrolling="no" onload="iFrameResize()"></iframe>脚本部分:
<script type="text/javascript" src="../src/iframeResizer.min.js"></script>
<script type="text/javascript">
<!--
<script language="JavaScript">
iFrameResize();
// this will resize the iframe every
// time you change the size of the window.
window.onresize=iFrameResize;
//Instead of using this you can use:
// <BODY onresize="resize_iframe()">
//--></script>同样,在iframe中调用的内容中,我有这一行代码。不过,我很肯定这部分是对的。
<script type="text/javascript" src="../js/iframeResizer.min.js"></script> 提前谢谢你的帮助。我很抱歉,如果我似乎是一个愚蠢的问题或愚蠢的问题,但我看到的例子原型: iFrameResize({options},选择器);
但是,您不需要一个“事件”来触发该函数吗?查看我的代码,我使用onload事件,它不起作用。如果我将iframe的ID设置为建立选择器
<iframe id="testframe" src="http://www.domain.net/store20/StoreTop.aspx?StoreID=17" width="100%" scrolling="no" onload="iFrameResize()"></iframe>并称之为:
iFrameResize(,testframe);或者这个:
iFrameResize(,$("#testframe"));还是不起作用。我没有任何选项,并希望将选项保留为默认选项。
发布于 2015-03-10 19:39:38
这两种你都可以。
$("#testframe").iFrameResize();或
iFrameResize(null,"#testframe");发布于 2014-11-10 08:07:16
您可以使用
iFrameResize(,'iframe#testframe');https://stackoverflow.com/questions/24704843
复制相似问题