1
我有以下看法页在asp.net MVC3,如何检查iframe的HTML文件滚动到达底部或不使用jQuery
@using (Html.BeginForm())
{
<p>
test test
test test
test test
test test
test test
</p>
<article border="0" >
<iframe src ="@Url.Content("~/Content/test.html")" width="100%" height="300px" id="iframeContent"></iframe>
</article>
<p>
test test
test test
test test
test test
test test
</p>
<table>
<tr>
<td>
sample data
</td>
</tr>
</table>
}
的IFRAME SRC的html文件是有点大,所以它是有滚动。我想检查html文件滚动是否到达底部。如果达到最低点,我需要做一些验证。
我可以通过使用下面的jquery完成整个页面,但我无法弄清楚如何才能完成只有iframe滚动内容。任何建议人?
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
alert("Bottom Reached!");
}
});
上面的代码是不工作 – Govind 2014-09-05 08:08:49
尝试添加它来docuement ready事件。 mabe当你调用函数时iframe不在dom中 – MoLow 2014-09-05 11:22:23
我试过的代码是在dom准备好的只有.. – Govind 2014-09-06 21:46:32