Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/436.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用jquery检查iframe html文件滚动是否到达底部_Javascript_Jquery_Html_Css_Iframe - Fatal编程技术网

Javascript 如何使用jquery检查iframe html文件滚动是否到达底部

Javascript 如何使用jquery检查iframe html文件滚动是否到达底部,javascript,jquery,html,css,iframe,Javascript,Jquery,Html,Css,Iframe,我在asp.net MVC3中有下面的查看页面 @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

我在asp.net MVC3中有下面的查看页面

@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').bind('load',function(){
    var $win=$('iframe').get(0).contentWindow;
    $win.scroll(function() {
       if($win.scrollTop() + $(window).height() == $(document).height()) {
           alert("Bottom Reached!");
       }
    });
});

尝试将其添加到文档准备事件。可能调用函数时iframe不在dom中
$('iframe').bind('load',function(){
    var $win=$('iframe').get(0).contentWindow;
    $win.scroll(function() {
       if($win.scrollTop() + $(window).height() == $(document).height()) {
           alert("Bottom Reached!");
       }
    });
});